Skip to content

Commit 110e0a3

Browse files
fox0jgarzik
authored andcommitted
Fix clippy::manual_unwrap_or
1 parent dc714a1 commit 110e0a3

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

misc/test.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,9 @@ fn parse_binary_op(s: &str) -> Option<BinOp> {
182182
}
183183
}
184184

185-
fn parse_int(s: &str) -> i64 {
186-
match s.parse::<i64>() {
187-
Ok(i) => i,
188-
Err(_) => 0,
189-
}
190-
}
191-
192185
fn eval_binary_int(op: &BinOp, s1: &str, s2: &str) -> bool {
193-
let i1 = parse_int(s1);
194-
let i2 = parse_int(s2);
186+
let i1: i64 = s1.parse().unwrap_or(0);
187+
let i2: i64 = s2.parse().unwrap_or(0);
195188

196189
match op {
197190
BinOp::IntEq => i1 == i2,

text/pr_util/args.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,10 @@ impl Parameters {
355355

356356
let (first_page, last_page) = args.pages.unwrap_or((1, None));
357357

358-
let num_columns = {
359-
if args.merge {
360-
args.file.len()
361-
} else if let Some(n) = args.columns {
362-
n
363-
} else {
364-
1
365-
}
358+
let num_columns = if args.merge {
359+
args.file.len()
360+
} else {
361+
args.columns.unwrap_or(1)
366362
};
367363

368364
let form_feed = args.form_feed || args.form_feed_with_pause;

0 commit comments

Comments
 (0)