Use .get(0) instead of .iter().next(), clippy warning

https://rust-lang.github.io/rust-clippy/master/index.html#iter_next_slice
This commit is contained in:
Steve Myers 2021-04-08 12:16:58 -07:00
parent af98b8da06
commit 2380634496
No known key found for this signature in database
GPG Key ID: 8105A46B22C2D051

View File

@ -190,7 +190,7 @@ pub enum AddressIndex {
/// then the returned address and subsequent addresses returned by calls to `AddressIndex::New` /// then the returned address and subsequent addresses returned by calls to `AddressIndex::New`
/// and `AddressIndex::LastUsed` may have already been used. Also if the index is reset to a /// and `AddressIndex::LastUsed` may have already been used. Also if the index is reset to a
/// value earlier than the [`crate::blockchain::Blockchain`] stop_gap (default is 20) then a /// value earlier than the [`crate::blockchain::Blockchain`] stop_gap (default is 20) then a
/// larger stop_gap should be used to monitor for all possibly used addresses. /// larger stop_gap should be used to monitor for all possibly used addresses.
Reset(u32), Reset(u32),
} }
@ -1633,7 +1633,7 @@ mod test {
.database .database
.borrow_mut() .borrow_mut()
.set_script_pubkey( .set_script_pubkey(
&bitcoin::Address::from_str(&tx_meta.output.iter().next().unwrap().to_address) &bitcoin::Address::from_str(&tx_meta.output.get(0).unwrap().to_address)
.unwrap() .unwrap()
.script_pubkey(), .script_pubkey(),
KeychainKind::External, KeychainKind::External,
@ -3615,7 +3615,7 @@ mod test {
#[test] #[test]
fn test_unused_address() { fn test_unused_address() {
let db = MemoryDatabase::new(); let db = MemoryDatabase::new();
let wallet = Wallet::new_offline("wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)", let wallet = Wallet::new_offline("wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)",
None, Network::Testnet, db).unwrap(); None, Network::Testnet, db).unwrap();
assert_eq!( assert_eq!(