From: LLFourn Date: Wed, 14 Oct 2020 02:55:33 +0000 (+1100) Subject: Use collect to avoid iter unwrapping Options X-Git-Tag: v0.2.0~106 X-Git-Url: http://internal-gitweb-vhost/%22https:/parse/scripts/database/-script/-debug/struct.ServiceFlags.html?a=commitdiff_plain;h=64b4cfe3080b11eccd5b2c9d79422b0f5ff32026;p=bdk Use collect to avoid iter unwrapping Options --- 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 => {