From c31b0c4b8a466297d936534824b92a52e382a6c0 Mon Sep 17 00:00:00 2001 From: sprites0 <199826320+sprites0@users.noreply.github.com> Date: Fri, 4 Jul 2025 23:22:09 +0000 Subject: [PATCH] chore: clippy --- src/hl_node_compliance.rs | 8 +++----- src/node/rpc/block.rs | 4 ++-- src/node/rpc/mod.rs | 8 +------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/hl_node_compliance.rs b/src/hl_node_compliance.rs index a26274c62..6f29e7d98 100644 --- a/src/hl_node_compliance.rs +++ b/src/hl_node_compliance.rs @@ -147,7 +147,7 @@ impl EthFilterApiServer> transactions .iter() .filter(|tx| tx.is_system_transaction()) - .map(|tx| tx.tx_hash().clone()) + .map(|tx| *tx.tx_hash()) .collect::>() }) .collect(); @@ -216,12 +216,10 @@ impl EthPubSubApiServer> fn not_from_system_tx(log: &Log, provider: &Eth::Provider) -> bool { let block = provider.block_by_number(log.block_number.unwrap()).unwrap().unwrap(); let transactions = block.body.transactions().collect::>(); - transactions + !transactions .iter() .filter(|tx| tx.is_system_transaction()) - .map(|tx| tx.tx_hash().clone()) - .find(|tx_hash| tx_hash == &log.transaction_hash.unwrap()) - .is_none() + .map(|tx| *tx.tx_hash()).any(|tx_hash| tx_hash == log.transaction_hash.unwrap()) } /// Helper to convert a serde error into an [`ErrorObject`] diff --git a/src/node/rpc/block.rs b/src/node/rpc/block.rs index 95b3bdd20..65220afb2 100644 --- a/src/node/rpc/block.rs +++ b/src/node/rpc/block.rs @@ -145,7 +145,7 @@ where if let Some(recovered_block) = recovered_block { let recovered_block = if hl_node_compliant { - filter_if_hl_node_compliant(&*recovered_block) + filter_if_hl_node_compliant(&recovered_block) } else { (*recovered_block).clone() }; @@ -167,7 +167,7 @@ fn filter_if_hl_node_compliant( .position(|tx| !tx.is_system_transaction()) .unwrap_or(transactions.len()); - let mut new_block: HlBlock = sealed_block.clone_block().into(); + let mut new_block: HlBlock = sealed_block.clone_block(); new_block.body.transactions.drain(..to_skip); let new_sealed_block = SealedBlock::new_unchecked(new_block, sealed_block.hash()); let new_senders = recovered_block.senders()[to_skip..].to_vec(); diff --git a/src/node/rpc/mod.rs b/src/node/rpc/mod.rs index ef09f7118..06fc4e680 100644 --- a/src/node/rpc/mod.rs +++ b/src/node/rpc/mod.rs @@ -258,19 +258,13 @@ where } /// Builds [`HlEthApi`] for HL. -#[derive(Debug)] +#[derive(Debug, Default)] #[non_exhaustive] pub struct HlEthApiBuilder { /// Whether the node is in HL node compliant mode. pub(crate) hl_node_compliant: bool, } -impl Default for HlEthApiBuilder { - fn default() -> Self { - Self { hl_node_compliant: false } - } -} - impl EthApiBuilder for HlEthApiBuilder where N: FullNodeComponents,