Skip to content

Commit 211f0cb

Browse files
committed
Combine terminal variants
We have various variants in this pattern that return the same thing, we can combine them to make the code more terse with no loss of clarity.
1 parent c8f9ee9 commit 211f0cb

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/miniscript/satisfy.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,15 +1332,11 @@ impl Satisfaction {
13321332
stack: Witness::empty(),
13331333
has_sig: false,
13341334
},
1335-
Terminal::True => Satisfaction {
1336-
stack: Witness::Impossible,
1337-
has_sig: false,
1338-
},
1339-
Terminal::Older(_) => Satisfaction {
1340-
stack: Witness::Impossible,
1341-
has_sig: false,
1342-
},
1343-
Terminal::After(_) => Satisfaction {
1335+
Terminal::True
1336+
| Terminal::Older(_)
1337+
| Terminal::After(_)
1338+
| Terminal::Verify(_)
1339+
| Terminal::OrC(..) => Satisfaction {
13441340
stack: Witness::Impossible,
13451341
has_sig: false,
13461342
},
@@ -1361,10 +1357,6 @@ impl Satisfaction {
13611357
stack: Witness::push_0(),
13621358
has_sig: false,
13631359
},
1364-
Terminal::Verify(_) => Satisfaction {
1365-
stack: Witness::Impossible,
1366-
has_sig: false,
1367-
},
13681360
Terminal::AndV(ref v, ref other) => {
13691361
let vsat =
13701362
Self::satisfy_helper(&v.node, stfr, root_has_sig, leaf_hash, min_fn, thresh_fn);
@@ -1406,10 +1398,6 @@ impl Satisfaction {
14061398
has_sig: rnsat.has_sig || lnsat.has_sig,
14071399
}
14081400
}
1409-
Terminal::OrC(..) => Satisfaction {
1410-
stack: Witness::Impossible,
1411-
has_sig: false,
1412-
},
14131401
Terminal::OrI(ref l, ref r) => {
14141402
let lnsat = Self::dissatisfy_helper(
14151403
&l.node,

0 commit comments

Comments
 (0)