From 62ccc9102cd3b2497cfe475bd33ab6acc73e2099 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 25 May 2022 13:36:51 +1000 Subject: [PATCH] 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. --- src/util/taproot.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 3e7a02c7..2bd2a24b 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -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.