Skip to content

Commit

Permalink
Use iter().flatten().any() instead of if let Some
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed May 25, 2022
1 parent 4b28a1b commit 62ccc91
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,7 @@ impl TaprootBuilder {

/// Checks if the builder has hidden nodes.
pub fn has_hidden_nodes(&self) -> bool {
for node in &self.branch {
if let Some(node) = node {
if node.has_hidden_nodes {
return true
}
}
}
false
self.branch.iter().flatten().any(|node| node.has_hidden_nodes)
}

/// Creates a [`TaprootSpendInfo`] with the given internal key.
Expand Down

0 comments on commit 62ccc91

Please sign in to comment.