Skip to content

Commit

Permalink
Use iter().flatten() 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

As suggested use `iter().flatten()` to get only the non-none nodes.
  • Loading branch information
tcharding committed May 25, 2022
1 parent 4b28a1b commit 3b3c378
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,9 @@ 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
}
for node in self.branch.iter().flatten() {
if node.has_hidden_nodes {
return true
}
}
false
Expand Down

0 comments on commit 3b3c378

Please sign in to comment.