Skip to content

Commit 721e16b

Browse files
committed
Use unwrap_or
Currently we are using `map_or` in a convoluted manner, we can just use `unwrap_or` to get the inner value or default to 0. Refactor only, no logic changes.
1 parent 10e5982 commit 721e16b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/policy/semantic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
406406
.count();
407407

408408
let n = subs.len() - unsatisfied_count - trivial_count; // remove all true/false
409-
let m = k.checked_sub(trivial_count).map_or(0, |x| x); // satisfy all trivial
409+
let m = k.checked_sub(trivial_count).unwrap_or(0); // satisfy all trivial
410410

411411
let is_and = m == n;
412412
let is_or = m == 1;

0 commit comments

Comments
 (0)