From 80118155d6b49734335cbdcad7022dc4d95dbebc Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:18:02 +0100 Subject: [PATCH] chore: clippy (#834) --- crates/dyn-abi/src/dynamic/event.rs | 2 +- crates/json-abi/src/lib.rs | 1 + crates/json-abi/src/param.rs | 2 +- crates/primitives/src/bits/address.rs | 2 +- crates/primitives/src/postgres.rs | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/dyn-abi/src/dynamic/event.rs b/crates/dyn-abi/src/dynamic/event.rs index 79bc2ae69..b3ba478a2 100644 --- a/crates/dyn-abi/src/dynamic/event.rs +++ b/crates/dyn-abi/src/dynamic/event.rs @@ -159,7 +159,7 @@ impl DecodedEvent { self.selector .iter() .copied() - .chain(self.indexed.iter().flat_map(DynSolValue::as_word).map(B256::from)) + .chain(self.indexed.iter().flat_map(DynSolValue::as_word)) .collect(), DynSolValue::encode_seq(&self.body).into(), ) diff --git a/crates/json-abi/src/lib.rs b/crates/json-abi/src/lib.rs index fc16bac53..b620c128e 100644 --- a/crates/json-abi/src/lib.rs +++ b/crates/json-abi/src/lib.rs @@ -15,6 +15,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![allow(clippy::literal_string_with_formatting_args)] // TODO: https://github.com/rust-lang/rust-clippy/issues/13885 #[macro_use] #[allow(unused_imports)] diff --git a/crates/json-abi/src/param.rs b/crates/json-abi/src/param.rs index b44e13771..7fb54858e 100644 --- a/crates/json-abi/src/param.rs +++ b/crates/json-abi/src/param.rs @@ -352,7 +352,7 @@ impl<'de> Deserialize<'de> for EventParam { name: inner.name, ty: inner.ty, indexed: inner.indexed.unwrap_or(false), - internal_type: inner.internal_type.map(Into::into), + internal_type: inner.internal_type, components: inner.components, }) }) diff --git a/crates/primitives/src/bits/address.rs b/crates/primitives/src/bits/address.rs index 94cb3f417..bee91fb09 100644 --- a/crates/primitives/src/bits/address.rs +++ b/crates/primitives/src/bits/address.rs @@ -320,7 +320,7 @@ impl Address { for (i, out) in buf[2..].iter_mut().enumerate() { // This is made branchless for easier vectorization. // Get the i-th nibble of the hash. - let hash_nibble = hash[i / 2] >> (4 * (1 - i % 2)) & 0xf; + let hash_nibble = (hash[i / 2] >> (4 * (1 - i % 2))) & 0xf; // Make the character ASCII uppercase if it's a hex letter and the hash nibble is >= 8. // We can use a simpler comparison for checking if the character is a hex letter because // we know `out` is a hex-encoded character (`b'0'..=b'9' | b'a'..=b'f'`). diff --git a/crates/primitives/src/postgres.rs b/crates/primitives/src/postgres.rs index ba1c9f25a..eddf944e1 100644 --- a/crates/primitives/src/postgres.rs +++ b/crates/primitives/src/postgres.rs @@ -260,7 +260,7 @@ impl<'a, const BITS: usize, const LIMBS: usize> FromSql<'a> for Signed 0 { for i in (1..raw.len()).rev() { - raw[i] = raw[i] >> padding | raw[i - 1] << (8 - padding); + raw[i] = (raw[i] >> padding) | (raw[i - 1] << (8 - padding)); } raw[0] >>= padding; }