From 64b4cfe3080b11eccd5b2c9d79422b0f5ff32026 Mon Sep 17 00:00:00 2001 From: LLFourn Date: Wed, 14 Oct 2020 13:55:33 +1100 Subject: [PATCH] Use collect to avoid iter unwrapping Options --- src/wallet/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 1629107b..a8beb4e7 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -947,12 +947,10 @@ where let full_utxos = raw_utxos .iter() .map(|u| self.database.borrow().get_utxo(&u)) - .collect::, _>>()?; - if !full_utxos.iter().all(|u| u.is_some()) { - return Err(Error::UnknownUTXO); - } + .collect::>, _>>()? + .ok_or(Error::UnknownUTXO)?; - Ok((full_utxos.into_iter().map(|x| x.unwrap()).collect(), true)) + Ok((full_utxos, true)) } // otherwise limit ourselves to the spendable utxos for the selected policy, and the `send_all` setting None => {