Skip to content

Commit 54412f1

Browse files
committed
Simplify duplicate code
Clippy emits: error: this `if` has identical blocks Simplify the code by removing the duplicate blocks.
1 parent 45fd5f7 commit 54412f1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/miniscript/astelem.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,10 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> fmt::Display for Terminal<Pk, Ctx> {
405405
}
406406
// Add a ':' wrapper if there are other wrappers apart from c:pk_k()
407407
// tvc:pk_k() -> tv:pk()
408-
Some(('c', ms)) => {
409-
if let Terminal::PkK(ref _pk) = ms.node {
410-
fmt::Write::write_char(f, ':')?;
411-
} else if let Terminal::PkH(ref _pkh) = ms.node {
412-
fmt::Write::write_char(f, ':')?;
413-
}
414-
}
408+
Some(('c', ms)) => match ms.node {
409+
Terminal::PkK(_) | Terminal::PkH(_) => fmt::Write::write_char(f, ':')?,
410+
_ => {}
411+
},
415412
_ => {}
416413
};
417414
write!(f, "{}", sub)

0 commit comments

Comments
 (0)