Use iter().flatten().any() instead of if let Some
Clippy emits: warning: unnecessary `if let` since only the `Some` variant of the iterator element is used Use combinator chain `iter().flatten().any()` to check for an node with hidden nodes.
This commit is contained in:
parent
4b28a1bb97
commit
62ccc9102c
|
@ -442,14 +442,7 @@ impl TaprootBuilder {
|
||||||
|
|
||||||
/// Checks if the builder has hidden nodes.
|
/// Checks if the builder has hidden nodes.
|
||||||
pub fn has_hidden_nodes(&self) -> bool {
|
pub fn has_hidden_nodes(&self) -> bool {
|
||||||
for node in &self.branch {
|
self.branch.iter().flatten().any(|node| node.has_hidden_nodes)
|
||||||
if let Some(node) = node {
|
|
||||||
if node.has_hidden_nodes {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a [`TaprootSpendInfo`] with the given internal key.
|
/// Creates a [`TaprootSpendInfo`] with the given internal key.
|
||||||
|
|
Loading…
Reference in New Issue