From 31b64b30828390510dfa63626152016d7b16d42c Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 4 Sep 2022 21:23:38 -0400 Subject: [PATCH] Update according to the latest clippy --- coins/monero/src/ringct/clsag/multisig.rs | 4 ++-- coins/monero/src/rpc.rs | 4 ++-- coins/monero/src/transaction.rs | 2 +- coins/monero/src/wallet/scan.rs | 8 ++++---- crypto/frost/src/lib.rs | 6 +++--- crypto/transcript/src/lib.rs | 2 +- processor/src/wallet.rs | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/coins/monero/src/ringct/clsag/multisig.rs b/coins/monero/src/ringct/clsag/multisig.rs index 6bd2e984..a2a014fc 100644 --- a/coins/monero/src/ringct/clsag/multisig.rs +++ b/coins/monero/src/ringct/clsag/multisig.rs @@ -43,8 +43,8 @@ impl ClsagInput { // Doesn't include global output indexes as CLSAG doesn't care and won't be affected by it // They're just a unreliable reference to this data which will be included in the message // if in use - ring.extend(&pair[0].compress().to_bytes()); - ring.extend(&pair[1].compress().to_bytes()); + ring.extend(pair[0].compress().to_bytes()); + ring.extend(pair[1].compress().to_bytes()); } transcript.append_message(b"ring", &ring); diff --git a/coins/monero/src/rpc.rs b/coins/monero/src/rpc.rs index b8e66778..c83b5997 100644 --- a/coins/monero/src/rpc.rs +++ b/coins/monero/src/rpc.rs @@ -160,14 +160,14 @@ impl Rpc { .rpc_call( "get_transactions", Some(json!({ - "txs_hashes": hashes.iter().map(|hash| hex::encode(&hash)).collect::>() + "txs_hashes": hashes.iter().map(hex::encode).collect::>() })), ) .await?; if !txs.missed_tx.is_empty() { Err(RpcError::TransactionsNotFound( - txs.missed_tx.iter().map(|hash| hex::decode(&hash).unwrap().try_into().unwrap()).collect(), + txs.missed_tx.iter().map(|hash| hex::decode(hash).unwrap().try_into().unwrap()).collect(), ))?; } diff --git a/coins/monero/src/transaction.rs b/coins/monero/src/transaction.rs index 9a6d44ba..3a1d5889 100644 --- a/coins/monero/src/transaction.rs +++ b/coins/monero/src/transaction.rs @@ -277,7 +277,7 @@ impl Transaction { serialized.clear(); self.rct_signatures.prunable.signature_serialize(&mut serialized).unwrap(); - sig_hash.extend(&hash(&serialized)); + sig_hash.extend(hash(&serialized)); hash(&sig_hash) } diff --git a/coins/monero/src/wallet/scan.rs b/coins/monero/src/wallet/scan.rs index 48c7e11f..b3d635e4 100644 --- a/coins/monero/src/wallet/scan.rs +++ b/coins/monero/src/wallet/scan.rs @@ -22,7 +22,7 @@ pub struct AbsoluteId { impl AbsoluteId { pub fn serialize(&self) -> Vec { let mut res = Vec::with_capacity(32 + 1); - res.extend(&self.tx); + res.extend(self.tx); res.push(self.o); res } @@ -80,10 +80,10 @@ impl Metadata { res.extend(self.subaddress.1.to_le_bytes()); res.extend(self.payment_id); if let Some(data) = self.arbitrary_data.as_ref() { - res.extend(&[1, u8::try_from(data.len()).unwrap()]); + res.extend([1, u8::try_from(data.len()).unwrap()]); res.extend(data); } else { - res.extend(&[0]); + res.extend([0]); } res } @@ -173,7 +173,7 @@ impl SpendableOutput { pub fn serialize(&self) -> Vec { let mut serialized = self.output.serialize(); - serialized.extend(&self.global_index.to_le_bytes()); + serialized.extend(self.global_index.to_le_bytes()); serialized } diff --git a/crypto/frost/src/lib.rs b/crypto/frost/src/lib.rs index d41600ce..cf1d0edf 100644 --- a/crypto/frost/src/lib.rs +++ b/crypto/frost/src/lib.rs @@ -212,9 +212,9 @@ impl FrostCore { let mut serialized = Vec::with_capacity(FrostCore::::serialized_len(self.params.n)); serialized.extend(u32::try_from(C::ID.len()).unwrap().to_be_bytes()); serialized.extend(C::ID); - serialized.extend(&self.params.t.to_be_bytes()); - serialized.extend(&self.params.n.to_be_bytes()); - serialized.extend(&self.params.i.to_be_bytes()); + serialized.extend(self.params.t.to_be_bytes()); + serialized.extend(self.params.n.to_be_bytes()); + serialized.extend(self.params.i.to_be_bytes()); serialized.extend(self.secret_share.to_repr().as_ref()); for l in 1 ..= self.params.n { serialized.extend(self.verification_shares[&l].to_bytes().as_ref()); diff --git a/crypto/transcript/src/lib.rs b/crypto/transcript/src/lib.rs index 658de159..8ad817ba 100644 --- a/crypto/transcript/src/lib.rs +++ b/crypto/transcript/src/lib.rs @@ -60,7 +60,7 @@ pub struct DigestTranscript(D); impl DigestTranscript { fn append(&mut self, kind: DigestTranscriptMember, value: &[u8]) { - self.0.update(&[kind.as_u8()]); + self.0.update([kind.as_u8()]); // Assumes messages don't exceed 16 exabytes self.0.update(u64::try_from(value.len()).unwrap().to_le_bytes()); self.0.update(value); diff --git a/processor/src/wallet.rs b/processor/src/wallet.rs index 72457054..d12614fa 100644 --- a/processor/src/wallet.rs +++ b/processor/src/wallet.rs @@ -108,7 +108,7 @@ impl CoinDb for MemCoinDb { fn select_inputs(inputs: &mut Vec) -> (Vec, u64) { // Sort to ensure determinism. Inefficient, yet produces the most legible code to be optimized // later - inputs.sort_by(|a, b| a.amount().cmp(&b.amount())); + inputs.sort_by_key(|a| a.amount()); // Select the maximum amount of outputs possible let res = inputs.split_off(inputs.len() - C::MAX_INPUTS.min(inputs.len()));