From ffd0f11252bcd9173d2bc9d0685304646c4a98d6 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 18 Feb 2025 09:18:59 +0100 Subject: [PATCH] chore: remove needless clippy lint (#14550) --- crates/chain-state/src/notifications.rs | 6 - crates/engine/util/src/reorg.rs | 2 - crates/ethereum/evm/src/eip6110.rs | 4 - crates/ethereum/evm/src/lib.rs | 8 -- crates/ethereum/payload/src/lib.rs | 2 - .../downloaders/src/receipt_file_client.rs | 12 +- crates/net/eth-wire-types/src/receipts.rs | 4 - crates/optimism/cli/src/receipt_file_codec.rs | 1 - crates/rpc/rpc/src/eth/helpers/call.rs | 1 - .../rpc/rpc/src/eth/helpers/pending_block.rs | 2 - .../storage/provider/src/test_utils/blocks.rs | 120 ++++++++---------- 11 files changed, 52 insertions(+), 110 deletions(-) diff --git a/crates/chain-state/src/notifications.rs b/crates/chain-state/src/notifications.rs index 5046f48ad..70f8e9986 100644 --- a/crates/chain-state/src/notifications.rs +++ b/crates/chain-state/src/notifications.rs @@ -324,13 +324,11 @@ mod tests { block2.set_hash(block2_hash); // Create a receipt for the transaction in block1. - #[allow(clippy::needless_update)] let receipt1 = Receipt { tx_type: TxType::Legacy, cumulative_gas_used: 12345, logs: vec![], success: true, - ..Default::default() }; // Wrap the receipt in a `Receipts` structure, as expected in the `ExecutionOutcome`. @@ -385,13 +383,11 @@ mod tests { old_block1.set_hash(B256::new([0x01; 32])); // Create a receipt for a transaction in the reverted block. - #[allow(clippy::needless_update)] let old_receipt = Receipt { tx_type: TxType::Legacy, cumulative_gas_used: 54321, logs: vec![], success: false, - ..Default::default() }; let old_receipts = vec![vec![old_receipt.clone()]]; @@ -416,13 +412,11 @@ mod tests { new_block1.set_hash(B256::new([0x02; 32])); // Create a receipt for a transaction in the new committed block. - #[allow(clippy::needless_update)] let new_receipt = Receipt { tx_type: TxType::Legacy, cumulative_gas_used: 12345, logs: vec![], success: true, - ..Default::default() }; let new_receipts = vec![vec![new_receipt.clone()]]; diff --git a/crates/engine/util/src/reorg.rs b/crates/engine/util/src/reorg.rs index f0232970e..25ee60460 100644 --- a/crates/engine/util/src/reorg.rs +++ b/crates/engine/util/src/reorg.rs @@ -338,13 +338,11 @@ where } cumulative_gas_used += exec_result.result.gas_used(); - #[allow(clippy::needless_update)] // side-effect of optimism fields receipts.push(Receipt { tx_type: tx.tx_type(), success: exec_result.result.is_success(), cumulative_gas_used, logs: exec_result.result.into_logs().into_iter().collect(), - ..Default::default() }); // append transaction to the list of executed transactions diff --git a/crates/ethereum/evm/src/eip6110.rs b/crates/ethereum/evm/src/eip6110.rs index d57002081..abbdea018 100644 --- a/crates/ethereum/evm/src/eip6110.rs +++ b/crates/ethereum/evm/src/eip6110.rs @@ -110,7 +110,6 @@ mod tests { fn test_parse_deposit_from_log() { let receipts = vec![ // https://etherscan.io/tx/0xa5239d4c542063d29022545835815b78b09f571f2bf1c8427f4765d6f5abbce9 - #[allow(clippy::needless_update)] // side-effect of optimism fields Receipt { // these don't matter tx_type: TxType::Legacy, @@ -119,10 +118,8 @@ mod tests { logs: serde_json::from_str( r#"[{"address":"0x00000000219ab540356cbb839cbe05303d7705fa","topics":["0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"],"data":"0x00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030998c8086669bf65e24581cda47d8537966e9f5066fc6ffdcba910a1bfb91eae7a4873fcce166a1c4ea217e6b1afd396200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002001000000000000000000000001c340fb72ed14d4eaa71f7633ee9e33b88d4f3900000000000000000000000000000000000000000000000000000000000000080040597307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006098ddbffd700c1aac324cfdf0492ff289223661eb26718ce3651ba2469b22f480d56efab432ed91af05a006bde0c1ea68134e0acd8cacca0c13ad1f716db874b44abfcc966368019753174753bca3af2ea84bc569c46f76592a91e97f311eddec0000000000000000000000000000000000000000000000000000000000000008e474160000000000000000000000000000000000000000000000000000000000","blockHash":"0x8d1289c5a7e0965b1d1bb75cdc4c3f73dda82d4ebb94ff5b98d1389cebd53b56","blockNumber":"0x12f0d8d","transactionHash":"0xa5239d4c542063d29022545835815b78b09f571f2bf1c8427f4765d6f5abbce9","transactionIndex":"0xc4","logIndex":"0x18f","removed":false}]"# ).unwrap(), - ..Default::default() }, // https://etherscan.io/tx/0xd9734d4e3953bcaa939fd1c1d80950ee54aeecc02eef6ae8179f47f5b7103338 - #[allow(clippy::needless_update)] // side-effect of optimism fields Receipt { // these don't matter tx_type: TxType::Legacy, @@ -131,7 +128,6 @@ mod tests { logs: serde_json::from_str( r#"[{"address":"0x00000000219ab540356cbb839cbe05303d7705fa","topics":["0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"],"data":"0x00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030a1a2ba870a90e889aa594a0cc1c6feffb94c2d8f65646c937f1f456a315ef649533e25a4614d8f4f66ebdb06481b90af0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200100000000000000000000000a0f04a231efbc29e1db7d086300ff550211c2f6000000000000000000000000000000000000000000000000000000000000000800405973070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060ad416d590e1a7f52baff770a12835b68904efad22cc9f8ba531e50cbbd26f32b9c7373cf6538a0577f501e4d3e3e63e208767bcccaae94e1e3720bfb734a286f9c017d17af46536545ccb7ca94d71f295e71f6d25bf978c09ada6f8d3f7ba0390000000000000000000000000000000000000000000000000000000000000008e374160000000000000000000000000000000000000000000000000000000000","blockHash":"0x8d1289c5a7e0965b1d1bb75cdc4c3f73dda82d4ebb94ff5b98d1389cebd53b56","blockNumber":"0x12f0d8d","transactionHash":"0xd9734d4e3953bcaa939fd1c1d80950ee54aeecc02eef6ae8179f47f5b7103338","transactionIndex":"0x7c","logIndex":"0xe2","removed":false}]"#, ).unwrap(), - ..Default::default() }, ]; diff --git a/crates/ethereum/evm/src/lib.rs b/crates/ethereum/evm/src/lib.rs index 316299031..33c8a8ee2 100644 --- a/crates/ethereum/evm/src/lib.rs +++ b/crates/ethereum/evm/src/lib.rs @@ -216,7 +216,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_default_spec() { let evm_config = EthEvmConfig::new(MAINNET.clone()); @@ -232,7 +231,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_custom_cfg() { let evm_config = EthEvmConfig::new(MAINNET.clone()); @@ -250,7 +248,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_custom_block_and_tx() { let evm_config = EthEvmConfig::new(MAINNET.clone()); @@ -272,7 +269,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_spec_id() { let evm_config = EthEvmConfig::new(MAINNET.clone()); @@ -290,7 +286,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_and_default_inspector() { let evm_config = EthEvmConfig::new(MAINNET.clone()); let db = CacheDB::>::default(); @@ -305,7 +300,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_inspector_and_custom_cfg() { let evm_config = EthEvmConfig::new(MAINNET.clone()); let db = CacheDB::>::default(); @@ -322,7 +316,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_inspector_and_custom_block_tx() { let evm_config = EthEvmConfig::new(MAINNET.clone()); let db = CacheDB::>::default(); @@ -340,7 +333,6 @@ mod tests { } #[test] - #[allow(clippy::needless_update)] fn test_evm_with_env_inspector_and_spec_id() { let evm_config = EthEvmConfig::new(MAINNET.clone()); let db = CacheDB::>::default(); diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 5b7fba221..49ff2d908 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -327,13 +327,11 @@ where cumulative_gas_used += gas_used; // Push transaction changeset and calculate header bloom filter for receipt. - #[allow(clippy::needless_update)] // side-effect of optimism fields receipts.push(Receipt { tx_type: tx.tx_type(), success: result.is_success(), cumulative_gas_used, logs: result.into_logs().into_iter().collect(), - ..Default::default() }); // update add to total fees diff --git a/crates/net/downloaders/src/receipt_file_client.rs b/crates/net/downloaders/src/receipt_file_client.rs index beca2f46b..a5aa0ff0d 100644 --- a/crates/net/downloaders/src/receipt_file_client.rs +++ b/crates/net/downloaders/src/receipt_file_client.rs @@ -245,14 +245,12 @@ mod test { let MockReceipt { tx_type, status, cumulative_gas_used, logs, block_number: number } = exported_receipt; - #[allow(clippy::needless_update)] let receipt = Receipt { tx_type: TxType::try_from(tx_type.to_be_bytes()[0]) .map_err(|err| FileClientError::Rlp(err.into(), vec![tx_type]))?, success: status != 0, cumulative_gas_used, logs, - ..Default::default() }; Ok(Self { receipt, number }) @@ -386,13 +384,12 @@ mod test { .unwrap(), }; - // #[allow(clippy::needless_update)] not recognised, ..Default::default() needed so optimism // feature must not be brought into scope let mut receipt = Receipt { tx_type: TxType::Legacy, success: true, cumulative_gas_used: 202819, - ..Default::default() + logs: vec![], }; receipt.logs = vec![log_1, log_2, log_3]; @@ -438,13 +435,11 @@ mod test { .unwrap(), }; - // #[allow(clippy::needless_update)] not recognised, ..Default::default() needed so optimism - // feature must not be brought into scope let mut receipt = Receipt { tx_type: TxType::Legacy, success: true, cumulative_gas_used: 116237, - ..Default::default() + logs: vec![], }; receipt.logs = vec![log_1, log_2]; @@ -490,8 +485,6 @@ mod test { .unwrap(), }; - // #[allow(clippy::needless_update)] not recognised, ..Default::default() needed so optimism - // feature must not be brought into scope let mut receipt = Receipt { tx_type: TxType::Legacy, success: true, @@ -528,7 +521,6 @@ mod test { } #[test] - #[allow(clippy::needless_update)] fn receipts_codec() { // rig diff --git a/crates/net/eth-wire-types/src/receipts.rs b/crates/net/eth-wire-types/src/receipts.rs index 7e45c0d49..d592469b8 100644 --- a/crates/net/eth-wire-types/src/receipts.rs +++ b/crates/net/eth-wire-types/src/receipts.rs @@ -105,7 +105,6 @@ mod tests { // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 #[test] - #[allow(clippy::needless_update)] fn encode_receipts() { let expected = hex!("f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"); let mut data = vec![]; @@ -127,7 +126,6 @@ mod tests { ), ], success: false, - ..Default::default() }, logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(), }, @@ -139,7 +137,6 @@ mod tests { // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 #[test] - #[allow(clippy::needless_update)] fn decode_receipts() { let data = hex!("f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"); let request = RequestPair::::decode(&mut &data[..]).unwrap(); @@ -164,7 +161,6 @@ mod tests { ), ], success: false, - ..Default::default() }, logs_bloom: hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into(), }, diff --git a/crates/optimism/cli/src/receipt_file_codec.rs b/crates/optimism/cli/src/receipt_file_codec.rs index f89b95590..0345c0287 100644 --- a/crates/optimism/cli/src/receipt_file_codec.rs +++ b/crates/optimism/cli/src/receipt_file_codec.rs @@ -330,7 +330,6 @@ pub(crate) mod test { } #[test] - #[allow(clippy::needless_update)] fn receipts_codec() { // rig diff --git a/crates/rpc/rpc/src/eth/helpers/call.rs b/crates/rpc/rpc/src/eth/helpers/call.rs index fee3268f1..50897a710 100644 --- a/crates/rpc/rpc/src/eth/helpers/call.rs +++ b/crates/rpc/rpc/src/eth/helpers/call.rs @@ -101,7 +101,6 @@ where db.basic(caller).map_err(Into::into)?.map(|acc| acc.nonce).unwrap_or_default() }; - #[allow(clippy::needless_update)] let env = TxEnv { tx_type, gas_limit, diff --git a/crates/rpc/rpc/src/eth/helpers/pending_block.rs b/crates/rpc/rpc/src/eth/helpers/pending_block.rs index 872d721bb..ae2876ab2 100644 --- a/crates/rpc/rpc/src/eth/helpers/pending_block.rs +++ b/crates/rpc/rpc/src/eth/helpers/pending_block.rs @@ -115,13 +115,11 @@ where result: ExecutionResult>, cumulative_gas_used: u64, ) -> reth_provider::ProviderReceipt { - #[allow(clippy::needless_update)] Receipt { tx_type: tx.tx_type(), success: result.is_success(), cumulative_gas_used, logs: result.into_logs().into_iter().collect(), - ..Default::default() } } } diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index cfce13fe6..35572ed45 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -207,20 +207,16 @@ fn block1(number: BlockNumber) -> (RecoveredBlock, Execu .revert_account_info(number, account2, Some(None)) .state_storage(account1, HashMap::from_iter([(slot, (U256::ZERO, U256::from(10)))])) .build(), - vec![vec![ - #[allow(clippy::needless_update)] // side-effect of optimism fields - Receipt { - tx_type: TxType::Eip2930, - success: true, - cumulative_gas_used: 300, - logs: vec![Log::new_unchecked( - Address::new([0x60; 20]), - vec![B256::with_last_byte(1), B256::with_last_byte(2)], - Bytes::default(), - )], - ..Default::default() - }, - ]], + vec![vec![Receipt { + tx_type: TxType::Eip2930, + success: true, + cumulative_gas_used: 300, + logs: vec![Log::new_unchecked( + Address::new([0x60; 20]), + vec![B256::with_last_byte(1), B256::with_last_byte(2)], + Bytes::default(), + )], + }]], number, Vec::new(), ); @@ -265,20 +261,16 @@ fn block2( ) .revert_storage(number, account, Vec::from([(slot, U256::from(10))])) .build(), - vec![vec![ - #[allow(clippy::needless_update)] // side-effect of optimism fields - Receipt { - tx_type: TxType::Eip1559, - success: false, - cumulative_gas_used: 400, - logs: vec![Log::new_unchecked( - Address::new([0x61; 20]), - vec![B256::with_last_byte(3), B256::with_last_byte(4)], - Bytes::default(), - )], - ..Default::default() - }, - ]], + vec![vec![Receipt { + tx_type: TxType::Eip1559, + success: false, + cumulative_gas_used: 400, + logs: vec![Log::new_unchecked( + Address::new([0x61; 20]), + vec![B256::with_last_byte(3), B256::with_last_byte(4)], + Bytes::default(), + )], + }]], number, Vec::new(), ); @@ -332,20 +324,16 @@ fn block3( } let execution_outcome = ExecutionOutcome::new( bundle_state_builder.build(), - vec![vec![ - #[allow(clippy::needless_update)] // side-effect of optimism fields - Receipt { - tx_type: TxType::Eip1559, - success: true, - cumulative_gas_used: 400, - logs: vec![Log::new_unchecked( - Address::new([0x61; 20]), - vec![B256::with_last_byte(3), B256::with_last_byte(4)], - Bytes::default(), - )], - ..Default::default() - }, - ]], + vec![vec![Receipt { + tx_type: TxType::Eip1559, + success: true, + cumulative_gas_used: 400, + logs: vec![Log::new_unchecked( + Address::new([0x61; 20]), + vec![B256::with_last_byte(3), B256::with_last_byte(4)], + Bytes::default(), + )], + }]], number, Vec::new(), ); @@ -419,20 +407,16 @@ fn block4( } let execution_outcome = ExecutionOutcome::new( bundle_state_builder.build(), - vec![vec![ - #[allow(clippy::needless_update)] // side-effect of optimism fields - Receipt { - tx_type: TxType::Eip1559, - success: true, - cumulative_gas_used: 400, - logs: vec![Log::new_unchecked( - Address::new([0x61; 20]), - vec![B256::with_last_byte(3), B256::with_last_byte(4)], - Bytes::default(), - )], - ..Default::default() - }, - ]], + vec![vec![Receipt { + tx_type: TxType::Eip1559, + success: true, + cumulative_gas_used: 400, + logs: vec![Log::new_unchecked( + Address::new([0x61; 20]), + vec![B256::with_last_byte(3), B256::with_last_byte(4)], + Bytes::default(), + )], + }]], number, Vec::new(), ); @@ -503,20 +487,16 @@ fn block5( } let execution_outcome = ExecutionOutcome::new( bundle_state_builder.build(), - vec![vec![ - #[allow(clippy::needless_update)] // side-effect of optimism fields - Receipt { - tx_type: TxType::Eip1559, - success: true, - cumulative_gas_used: 400, - logs: vec![Log::new_unchecked( - Address::new([0x61; 20]), - vec![B256::with_last_byte(3), B256::with_last_byte(4)], - Bytes::default(), - )], - ..Default::default() - }, - ]], + vec![vec![Receipt { + tx_type: TxType::Eip1559, + success: true, + cumulative_gas_used: 400, + logs: vec![Log::new_unchecked( + Address::new([0x61; 20]), + vec![B256::with_last_byte(3), B256::with_last_byte(4)], + Bytes::default(), + )], + }]], number, Vec::new(), );