diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 08d4d36c08..7e19136f88 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81" +channel = "1.82" components = [ "clippy", "rustfmt" ] diff --git a/zingocli/src/lib.rs b/zingocli/src/lib.rs index 33c37c86b6..39d5eec852 100644 --- a/zingocli/src/lib.rs +++ b/zingocli/src/lib.rs @@ -84,28 +84,30 @@ fn parse_uri(s: &str) -> Result { /// currently this is just a whitespace delimited string of 24 words. I am /// poking around to use the actual BIP39 parser (presumably from librustzcash). fn parse_seed(s: &str) -> Result { - if let Ok(s) = s.parse::() { - let count = s.split_whitespace().count(); - if count == 24 { - Ok(s) - } else { - Err(format!("Expected 24 words, but received: {}.", count)) + match s.parse::() { + Ok(s) => { + let count = s.split_whitespace().count(); + if count == 24 { + Ok(s) + } else { + Err(format!("Expected 24 words, but received: {}.", count)) + } } - } else { - Err("Unexpected failure to parse String!!".to_string()) + Err(_) => Err("Unexpected failure to parse String!!".to_string()), } } /// Parse encoded UFVK to String and check for whitespaces fn parse_ufvk(s: &str) -> Result { - if let Ok(s) = s.parse::() { - let count = s.split_whitespace().count(); - if count == 1 { - Ok(s) - } else { - Err("Encoded UFVK should not contain whitespace!".to_string()) + match s.parse::() { + Ok(s) => { + let count = s.split_whitespace().count(); + if count == 1 { + Ok(s) + } else { + Err("Encoded UFVK should not contain whitespace!".to_string()) + } } - } else { - Err("Unexpected failure to parse String!!".to_string()) + Err(_) => Err("Unexpected failure to parse String!!".to_string()), } } #[cfg(target_os = "linux")] diff --git a/zingolib/src/wallet/disk.rs b/zingolib/src/wallet/disk.rs index 717c52ed69..04a5c6d920 100644 --- a/zingolib/src/wallet/disk.rs +++ b/zingolib/src/wallet/disk.rs @@ -96,9 +96,8 @@ impl LightWallet { }; Vector::write(&mut writer, &seed_bytes, |w, byte| w.write_u8(*byte))?; - match &self.mnemonic { - Some(m) => writer.write_u32::(m.1)?, - None => (), + if let Some(m) = &self.mnemonic { + writer.write_u32::(m.1)?; } Ok(()) diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index 45b7f48219..a48854cb1a 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -121,27 +121,24 @@ impl TransactionRecord { to: D::Recipient, output_index: usize, ) { - match D::WalletNote::get_record_outputs(self) + if !D::WalletNote::get_record_outputs(self) .iter_mut() - .find(|n| n.note() == ¬e) + .any(|n| n.note() == ¬e) { - None => { - let nd = D::WalletNote::from_parts( - to.diversifier(), - note, - None, - None, - None, - None, - // if this is change, we'll mark it later in check_notes_mark_change - false, - false, - Some(output_index as u32), - ); - - D::WalletNote::transaction_metadata_notes_mut(self).push(nd); - } - Some(_) => {} + let nd = D::WalletNote::from_parts( + to.diversifier(), + note, + None, + None, + None, + None, + // if this is change, we'll mark it later in check_notes_mark_change + false, + false, + Some(output_index as u32), + ); + + D::WalletNote::transaction_metadata_notes_mut(self).push(nd); } }