From 73b92940723b68e6a9b5699c6879cc480cb2282e Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Wed, 9 Apr 2025 12:11:02 +0200 Subject: [PATCH] chore(lint): Remove redundant lint attributes (#15531) --- crates/engine/tree/src/tree/payload_processor/executor.rs | 4 ++-- crates/ethereum/primitives/src/transaction.rs | 2 +- crates/evm/execution-types/src/chain.rs | 1 - crates/evm/src/execute.rs | 2 +- crates/net/discv5/src/lib.rs | 1 - crates/net/network/src/budget.rs | 4 +--- crates/net/network/src/session/active.rs | 1 - crates/net/network/src/transactions/validation.rs | 2 +- crates/net/peers/src/lib.rs | 2 -- crates/optimism/primitives/src/transaction/signed.rs | 2 -- crates/optimism/rpc/src/eth/mod.rs | 1 - crates/primitives-traits/src/crypto.rs | 1 - crates/rpc/rpc-builder/src/eth.rs | 1 - crates/rpc/rpc-builder/src/lib.rs | 1 - crates/rpc/rpc-builder/src/metrics.rs | 2 -- crates/rpc/rpc-engine-api/src/lib.rs | 1 - crates/rpc/rpc-eth-api/src/helpers/block.rs | 2 -- crates/rpc/rpc-eth-api/src/helpers/call.rs | 1 - crates/storage/db-api/src/cursor.rs | 1 - crates/storage/db-api/src/tables/codecs/fuzz/mod.rs | 1 - crates/storage/libmdbx-rs/src/environment.rs | 1 - crates/storage/libmdbx-rs/src/txn_manager.rs | 1 - .../storage/provider/src/providers/blockchain_provider.rs | 3 +-- .../storage/provider/src/providers/static_file/manager.rs | 6 ++---- crates/trie/sparse/src/trie.rs | 1 - testing/ef-tests/tests/tests.rs | 1 - 26 files changed, 9 insertions(+), 37 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_processor/executor.rs b/crates/engine/tree/src/tree/payload_processor/executor.rs index 6a8932e68d..a112978f0a 100644 --- a/crates/engine/tree/src/tree/payload_processor/executor.rs +++ b/crates/engine/tree/src/tree/payload_processor/executor.rs @@ -25,7 +25,7 @@ impl Default for WorkloadExecutor { impl WorkloadExecutor { /// Creates a new executor with the given number of threads for cpu bound work (rayon). - #[allow(unused)] + #[expect(unused)] pub(super) fn with_num_cpu_threads(cpu_threads: usize) -> Self { Self { inner: WorkloadExecutorInner::new( @@ -50,7 +50,7 @@ impl WorkloadExecutor { } /// Returns access to the rayon pool - #[allow(unused)] + #[expect(unused)] pub(super) fn rayon_pool(&self) -> &Arc { &self.inner.rayon_pool } diff --git a/crates/ethereum/primitives/src/transaction.rs b/crates/ethereum/primitives/src/transaction.rs index 91bec7863c..3d6d6b13cb 100644 --- a/crates/ethereum/primitives/src/transaction.rs +++ b/crates/ethereum/primitives/src/transaction.rs @@ -617,7 +617,7 @@ impl From for Signed { #[cfg(any(test, feature = "arbitrary"))] impl<'a> arbitrary::Arbitrary<'a> for TransactionSigned { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - #[allow(unused_mut)] + #[expect(unused_mut)] let mut transaction = Transaction::arbitrary(u)?; let secp = secp256k1::Secp256k1::new(); diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 172d3ac1b8..0e21340ff8 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -461,7 +461,6 @@ impl IntoIterator for ChainBlocks<'_, B> { type IntoIter = alloc::collections::btree_map::IntoIter>; fn into_iter(self) -> Self::IntoIter { - #[allow(clippy::unnecessary_to_owned)] self.blocks.into_owned().into_iter() } } diff --git a/crates/evm/src/execute.rs b/crates/evm/src/execute.rs index 113414fca4..8e9d0f6dda 100644 --- a/crates/evm/src/execute.rs +++ b/crates/evm/src/execute.rs @@ -445,7 +445,7 @@ where /// A generic block executor that uses a [`BlockExecutor`] to /// execute blocks. -#[allow(missing_debug_implementations, dead_code)] +#[expect(missing_debug_implementations)] pub struct BasicBlockExecutor { /// Block execution strategy. pub(crate) strategy_factory: F, diff --git a/crates/net/discv5/src/lib.rs b/crates/net/discv5/src/lib.rs index cf3fd0ad62..feb7bb7122 100644 --- a/crates/net/discv5/src/lib.rs +++ b/crates/net/discv5/src/lib.rs @@ -774,7 +774,6 @@ mod test { // #[expect(unreachable_pub)] #[expect(unused)] - #[allow(clippy::assign_op_pattern)] mod sigp { use alloy_primitives::U256; use enr::{ diff --git a/crates/net/network/src/budget.rs b/crates/net/network/src/budget.rs index 5f5d888618..824148387b 100644 --- a/crates/net/network/src/budget.rs +++ b/crates/net/network/src/budget.rs @@ -51,9 +51,7 @@ macro_rules! poll_nested_stream_with_budget { loop { match $poll_stream { Poll::Ready(Some(item)) => { - #[allow(unused_mut)] - let mut f = $on_ready_some; - f(item); + $on_ready_some(item); budget -= 1; if budget == 0 { diff --git a/crates/net/network/src/session/active.rs b/crates/net/network/src/session/active.rs index 7b299b0941..45a7ec4768 100644 --- a/crates/net/network/src/session/active.rs +++ b/crates/net/network/src/session/active.rs @@ -169,7 +169,6 @@ impl ActiveSession { macro_rules! on_response { ($resp:ident, $item:ident) => {{ let RequestPair { request_id, message } = $resp; - #[allow(clippy::collapsible_match)] if let Some(req) = self.inflight_requests.remove(&request_id) { match req.request { RequestState::Waiting(PeerRequest::$item { response, .. }) => { diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index 6695240842..bb5ec9d02e 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -244,7 +244,7 @@ impl ValidateTx68 for EthMessageFilter { fn max_encoded_tx_length(&self, ty: TxType) -> Option { // the biggest transaction so far is a blob transaction, which is currently max 2^17, // encoded length, nonetheless, the blob tx may become bigger in the future. - #[allow(unreachable_patterns, clippy::match_same_arms)] + #[expect(clippy::match_same_arms)] match ty { TxType::Legacy | TxType::Eip2930 | TxType::Eip1559 => Some(MAX_MESSAGE_SIZE), TxType::Eip4844 => None, diff --git a/crates/net/peers/src/lib.rs b/crates/net/peers/src/lib.rs index a2fe4e2cf1..02df48318a 100644 --- a/crates/net/peers/src/lib.rs +++ b/crates/net/peers/src/lib.rs @@ -125,7 +125,6 @@ pub enum AnyNode { impl AnyNode { /// Returns the peer id of the node. - #[allow(clippy::missing_const_for_fn)] pub fn peer_id(&self) -> PeerId { match self { Self::NodeRecord(record) => record.id, @@ -136,7 +135,6 @@ impl AnyNode { } /// Returns the full node record if available. - #[allow(clippy::missing_const_for_fn)] pub fn node_record(&self) -> Option { match self { Self::NodeRecord(record) => Some(*record), diff --git a/crates/optimism/primitives/src/transaction/signed.rs b/crates/optimism/primitives/src/transaction/signed.rs index 0cd997d32b..8620ccbfc6 100644 --- a/crates/optimism/primitives/src/transaction/signed.rs +++ b/crates/optimism/primitives/src/transaction/signed.rs @@ -647,7 +647,6 @@ impl reth_codecs::Compact for OpTransactionSigned { #[cfg(any(test, feature = "arbitrary"))] impl<'a> arbitrary::Arbitrary<'a> for OpTransactionSigned { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - #[allow(unused_mut)] let mut transaction = OpTypedTransaction::arbitrary(u)?; let secp = secp256k1::Secp256k1::new(); @@ -737,7 +736,6 @@ pub mod serde_bincode_compat { /// Bincode-compatible [`super::OpTypedTransaction`] serde implementation. #[derive(Debug, Serialize, Deserialize)] - #[allow(missing_docs)] enum OpTypedTransaction<'a> { Legacy(TxLegacy<'a>), Eip2930(TxEip2930<'a>), diff --git a/crates/optimism/rpc/src/eth/mod.rs b/crates/optimism/rpc/src/eth/mod.rs index f3de7fa9ec..acd7dfe5ad 100644 --- a/crates/optimism/rpc/src/eth/mod.rs +++ b/crates/optimism/rpc/src/eth/mod.rs @@ -276,7 +276,6 @@ impl fmt::Debug for OpEthApi { } /// Container type `OpEthApi` -#[allow(missing_debug_implementations)] struct OpEthApiInner { /// Gateway to node's core components. eth_api: EthApiNodeBackend, diff --git a/crates/primitives-traits/src/crypto.rs b/crates/primitives-traits/src/crypto.rs index 6b022a6cab..4afbdf4240 100644 --- a/crates/primitives-traits/src/crypto.rs +++ b/crates/primitives-traits/src/crypto.rs @@ -60,7 +60,6 @@ pub mod secp256k1 { } #[cfg(any(test, feature = "secp256k1"))] -#[allow(unused, unreachable_pub)] mod impl_secp256k1 { use super::*; pub(crate) use ::secp256k1::Error; diff --git a/crates/rpc/rpc-builder/src/eth.rs b/crates/rpc/rpc-builder/src/eth.rs index 28f53fd066..a4909c5029 100644 --- a/crates/rpc/rpc-builder/src/eth.rs +++ b/crates/rpc/rpc-builder/src/eth.rs @@ -21,7 +21,6 @@ where /// Returns a new instance with the additional handlers for the `eth` namespace. /// /// This will spawn all necessary tasks for the additional handlers. - #[allow(clippy::too_many_arguments)] pub fn bootstrap(config: EthConfig, executor: Tasks, eth_api: EthApi) -> Self where Tasks: TaskSpawner + Clone + 'static, diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index b42546569a..07b7c856c6 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -176,7 +176,6 @@ where N: NodePrimitives, { /// Create a new instance of the builder - #[allow(clippy::too_many_arguments)] pub const fn new( provider: Provider, pool: Pool, diff --git a/crates/rpc/rpc-builder/src/metrics.rs b/crates/rpc/rpc-builder/src/metrics.rs index 57283ded37..f38dae0ce6 100644 --- a/crates/rpc/rpc-builder/src/metrics.rs +++ b/crates/rpc/rpc-builder/src/metrics.rs @@ -58,7 +58,6 @@ impl RpcRequestMetrics { } /// Creates a new instance of the metrics layer for Ws. - #[allow(unused)] pub(crate) fn ipc(module: &RpcModule<()>) -> Self { Self::new(module, RpcTransport::Ipc) } @@ -182,7 +181,6 @@ impl> Future for MeteredRequestFuture { pub(crate) enum RpcTransport { Http, WebSocket, - #[allow(unused)] Ipc, } diff --git a/crates/rpc/rpc-engine-api/src/lib.rs b/crates/rpc/rpc-engine-api/src/lib.rs index 5fc5629f7a..65088eac5a 100644 --- a/crates/rpc/rpc-engine-api/src/lib.rs +++ b/crates/rpc/rpc-engine-api/src/lib.rs @@ -29,7 +29,6 @@ pub use error::*; pub use reth_rpc_api::EngineApiServer; #[cfg(test)] -#[allow(unused_imports)] mod tests { // silence unused import warning use alloy_rlp as _; diff --git a/crates/rpc/rpc-eth-api/src/helpers/block.rs b/crates/rpc/rpc-eth-api/src/helpers/block.rs index 9cc1023fd1..5bdab4ed35 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/block.rs @@ -102,7 +102,6 @@ pub trait EthBlocks: LoadBlock { /// Helper function for `eth_getBlockReceipts`. /// /// Returns all transaction receipts in block, or `None` if block wasn't found. - #[allow(clippy::type_complexity)] fn block_receipts( &self, block_id: BlockId, @@ -111,7 +110,6 @@ pub trait EthBlocks: LoadBlock { Self: LoadReceipt; /// Helper method that loads a block and all its receipts. - #[allow(clippy::type_complexity)] fn load_block_and_receipts( &self, block_id: BlockId, diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 60d4f01ad7..a636866a6a 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -65,7 +65,6 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA /// The transactions are packed into individual blocks. Overrides can be provided. /// /// See also: - #[allow(clippy::type_complexity)] fn simulate_v1( &self, payload: SimulatePayload, diff --git a/crates/storage/db-api/src/cursor.rs b/crates/storage/db-api/src/cursor.rs index 4a7fccc128..ea81e75972 100644 --- a/crates/storage/db-api/src/cursor.rs +++ b/crates/storage/db-api/src/cursor.rs @@ -21,7 +21,6 @@ pub trait DbCursorRO { fn seek(&mut self, key: T::Key) -> PairResult; /// Position the cursor at the next KV pair, returning it. - #[allow(clippy::should_implement_trait)] fn next(&mut self) -> PairResult; /// Position the cursor at the previous KV pair, returning it. diff --git a/crates/storage/db-api/src/tables/codecs/fuzz/mod.rs b/crates/storage/db-api/src/tables/codecs/fuzz/mod.rs index 608bc9a5f1..cc62004dbb 100644 --- a/crates/storage/db-api/src/tables/codecs/fuzz/mod.rs +++ b/crates/storage/db-api/src/tables/codecs/fuzz/mod.rs @@ -22,7 +22,6 @@ macro_rules! impl_fuzzer_with_input { #[allow(unused_imports)] use super::inputs::*; - #[allow(unused_imports)] use crate::models::*; /// Encodes and decodes table types returning its encoded size and the decoded object. diff --git a/crates/storage/libmdbx-rs/src/environment.rs b/crates/storage/libmdbx-rs/src/environment.rs index 706a1f67c3..b7a8981eae 100644 --- a/crates/storage/libmdbx-rs/src/environment.rs +++ b/crates/storage/libmdbx-rs/src/environment.rs @@ -914,7 +914,6 @@ pub(crate) mod read_transactions { } /// Converts a [`HandleSlowReadersCallback`] to the actual FFI function pointer. -#[allow(clippy::missing_transmute_annotations)] fn convert_hsr_fn(callback: Option) -> ffi::MDBX_hsr_func { unsafe { std::mem::transmute(callback) } } diff --git a/crates/storage/libmdbx-rs/src/txn_manager.rs b/crates/storage/libmdbx-rs/src/txn_manager.rs index 6f7585b66a..0b1202095e 100644 --- a/crates/storage/libmdbx-rs/src/txn_manager.rs +++ b/crates/storage/libmdbx-rs/src/txn_manager.rs @@ -53,7 +53,6 @@ impl TxnManager { /// - [`TxnManagerMessage::Commit`] commits a transaction with [`ffi::mdbx_txn_commit_ex`] fn start_message_listener(&self, env: EnvPtr, rx: Receiver) { let task = move || { - #[allow(clippy::redundant_locals)] let env = env; loop { match rx.recv() { diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index 8348156571..6c6c421a4e 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -856,7 +856,7 @@ mod tests { (database_blocks.to_vec(), in_memory_blocks.to_vec()) } - #[allow(clippy::type_complexity, clippy::too_many_arguments)] + #[expect(clippy::type_complexity)] fn provider_with_chain_spec_and_random_blocks( rng: &mut impl Rng, chain_spec: Arc, @@ -2223,7 +2223,6 @@ mod tests { ); // Test range that spans database and in-memory - #[allow(unused_assignments)] { // This block will be persisted to disk and removed from memory AFTER the firsk database query. This ensures that we query the in-memory state before the database avoiding any race condition. persist_block_after_db_tx_creation(provider.clone(), in_memory_blocks[0].number); diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index 03f7a514f2..b3a4f7b862 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -168,10 +168,9 @@ impl StaticFileProvider { // appending/truncating rows for segment in event.paths { // Ensure it's a file with the .conf extension - #[allow(clippy::nonminimal_bool)] - if !segment + if segment .extension() - .is_some_and(|s| s.to_str() == Some(CONFIG_FILE_EXTENSION)) + .is_none_or(|s| s.to_str() != Some(CONFIG_FILE_EXTENSION)) { continue } @@ -653,7 +652,6 @@ impl StaticFileProvider { /// /// WARNING: No static file writer should be held before calling this function, otherwise it /// will deadlock. - #[allow(clippy::while_let_loop)] pub fn check_consistency( &self, provider: &Provider, diff --git a/crates/trie/sparse/src/trie.rs b/crates/trie/sparse/src/trie.rs index 96187a0618..ee44d0edd7 100644 --- a/crates/trie/sparse/src/trie.rs +++ b/crates/trie/sparse/src/trie.rs @@ -2255,7 +2255,6 @@ mod tests { assert_eq!(sparse, sparse_old); } - #[allow(clippy::type_complexity)] #[test] fn sparse_trie_fuzz() { // Having only the first 3 nibbles set, we narrow down the range of keys diff --git a/testing/ef-tests/tests/tests.rs b/testing/ef-tests/tests/tests.rs index 6b626d82c1..a2695686a1 100644 --- a/testing/ef-tests/tests/tests.rs +++ b/testing/ef-tests/tests/tests.rs @@ -12,7 +12,6 @@ macro_rules! general_state_test { }; } -#[allow(missing_docs)] mod general_state_tests { use super::*;