]> Untitled Git - bdk/commitdiff
Use !any() instead of find()...is_none()
authorTobin Harding <me@tobin.cc>
Thu, 6 May 2021 04:32:08 +0000 (14:32 +1000)
committerTobin Harding <me@tobin.cc>
Tue, 11 May 2021 00:51:44 +0000 (10:51 +1000)
Clippy emits:

  warning: called `is_none()` after searching an `Iterator` with `find`

As suggested, use the construct: `!foo.iter().any(...)`

src/wallet/mod.rs

index b4b9289932e1465eb7916e33b9da0de051c45f30..11b58849484d81e2066189864e1041304c176229 100644 (file)
@@ -1166,11 +1166,11 @@ where
         //    must_spend <- manually selected utxos
         //    may_spend  <- all other available utxos
         let mut may_spend = self.get_available_utxos()?;
+
         may_spend.retain(|may_spend| {
-            manually_selected
+            !manually_selected
                 .iter()
-                .find(|manually_selected| manually_selected.utxo.outpoint() == may_spend.0.outpoint)
-                .is_none()
+                .any(|manually_selected| manually_selected.utxo.outpoint() == may_spend.0.outpoint)
         });
         let mut must_spend = manually_selected;