Skip to content

Commit c0cd239

Browse files
decimal: Use unwrap_or_default
https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
1 parent 9ad579f commit c0cd239

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

exercises/decimal/example.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ impl Decimal {
5656
}
5757
Some(Decimal::new(
5858
try_opt!(digits.parse::<BigInt>().ok()),
59-
match decimal_index {
60-
Some(idx) => idx,
61-
None => 0,
62-
},
59+
decimal_index.unwrap_or_default(),
6360
))
6461
}
6562

0 commit comments

Comments
 (0)