Skip to content

Commit b9df24c

Browse files
committed
Clear block can be collapsed warnings
Clippy emits: warning: this `else { if .. }` block can be collapsed In one instance the nested if statements assist readability, add allow attribute. For all other instances collapse the blocks with no loss of clarity.
1 parent 0daded4 commit b9df24c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/interpreter/inner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub(super) enum Inner {
107107
/// Parses an `Inner` and appropriate `Stack` from completed transaction data,
108108
/// as well as the script that should be used as a scriptCode in a sighash
109109
/// Tr outputs don't have script code and return None.
110+
#[allow(clippy::collapsible_else_if)]
110111
pub(super) fn from_txdata<'txin>(
111112
spk: &bitcoin::Script,
112113
script_sig: &'txin bitcoin::Script,

src/miniscript/types/correctness.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,11 @@ impl Property for Correctness {
483483
Input::One | Input::OneNonZero => 1,
484484
Input::Any | Input::AnyNonZero => 2, // we only check if num args is max 1
485485
};
486-
if i == 0 {
487-
if subtype.base != Base::B {
488-
return Err(ErrorKind::ThresholdBase(i, subtype.base));
489-
}
490-
} else {
491-
if subtype.base != Base::W {
492-
return Err(ErrorKind::ThresholdBase(i, subtype.base));
493-
}
486+
if i == 0 && subtype.base != Base::B {
487+
return Err(ErrorKind::ThresholdBase(i, subtype.base));
488+
}
489+
if i != 0 && subtype.base != Base::W {
490+
return Err(ErrorKind::ThresholdBase(i, subtype.base));
494491
}
495492
if !subtype.unit {
496493
return Err(ErrorKind::ThresholdNonUnit(i));

0 commit comments

Comments
 (0)