From: Tobin Harding Date: Wed, 23 Dec 2020 03:08:54 +0000 (+1100) Subject: Use next instead of nth(0) X-Git-Tag: v0.5.0~10^2~14 X-Git-Url: http://internal-gitweb-vhost/%22https:/parse/scripts/database/-script/-debug/struct.WScriptHash.html?a=commitdiff_plain;h=824b00c9e049b4b9bee95619204730e63b29f5a7;p=bdk Use next instead of nth(0) As suggested by clippy we can use `.next()` on an iterator instead of `nth(0)`. Although arguably no clearer, and certainly no worse, it keeps clippy quiet and a clean lint is a good thing. --- diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 8bb254c4..8f26d06f 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -1942,7 +1942,7 @@ mod test { assert_eq!(psbt.inputs[0].bip32_derivation.len(), 1); assert_eq!( - psbt.inputs[0].bip32_derivation.values().nth(0).unwrap(), + psbt.inputs[0].bip32_derivation.values().next().unwrap(), &( Fingerprint::from_str("d34db33f").unwrap(), DerivationPath::from_str("m/44'/0'/0'/0/0").unwrap() @@ -1968,7 +1968,7 @@ mod test { assert_eq!(psbt.outputs[0].bip32_derivation.len(), 1); assert_eq!( - psbt.outputs[0].bip32_derivation.values().nth(0).unwrap(), + psbt.outputs[0].bip32_derivation.values().next().unwrap(), &( Fingerprint::from_str("d34db33f").unwrap(), DerivationPath::from_str("m/44'/0'/0'/0/5").unwrap()