Skip to content

Commit 1a1ac10

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 939695d commit 1a1ac10

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
@@ -414,7 +414,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
414414
.count();
415415

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

419419
// m == n denotes `and` and m == 1 denotes `or`
420420
let is_and = m == n;

0 commit comments

Comments
 (0)