From 938343be3b49a4035fbdd39dddd8280a5883a08b Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Tue, 19 Mar 2024 08:14:48 -0500 Subject: [PATCH] Enable clippy's branches_sharing_code linter --- Cargo.toml | 12 +++++++++--- crates/transaction-pool/src/pool/pending.rs | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 739d39589768..8f1d0d316be5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,6 +93,7 @@ clippy.redundant_clone = "deny" clippy.trait_duplication_in_bounds = "deny" clippy.uninlined_format_args = "deny" clippy.equatable_if_let = "deny" +clippy.branches_sharing_code = "deny" [workspace.package] version = "0.2.0-beta.3" @@ -192,8 +193,13 @@ reth-trie = { path = "crates/trie" } reth-trie-parallel = { path = "crates/trie-parallel" } # revm -revm = { version = "7.1.0", features = ["std", "secp256k1"], default-features = false } -revm-primitives = { version = "3.0.0", features = ["std"], default-features = false } +revm = { version = "7.1.0", features = [ + "std", + "secp256k1", +], default-features = false } +revm-primitives = { version = "3.0.0", features = [ + "std", +], default-features = false } revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "f96bc1f" } # eth @@ -237,7 +243,7 @@ strum = "0.26" rayon = "1.7" itertools = "0.12" parking_lot = "0.12" -metrics = "0.21.1" # Needed for `metrics-macro` to resolve the crate using `::metrics` notation +metrics = "0.21.1" # Needed for `metrics-macro` to resolve the crate using `::metrics` notation hex-literal = "0.4" once_cell = "1.17" syn = "2.0" diff --git a/crates/transaction-pool/src/pool/pending.rs b/crates/transaction-pool/src/pool/pending.rs index 34678b7289c8..2ca76222577b 100644 --- a/crates/transaction-pool/src/pool/pending.rs +++ b/crates/transaction-pool/src/pool/pending.rs @@ -264,13 +264,12 @@ impl PendingPool { // the transaction already has an ancestor, so we only need to ensure that the // highest nonces set actually contains the highest nonce for that sender self.highest_nonces.remove(ancestor); - self.highest_nonces.insert(tx.clone()); } else { // If there's __no__ ancestor in the pool, then this transaction is independent, this is // guaranteed because this pool is gapless. self.independent_transactions.insert(tx.clone()); - self.highest_nonces.insert(tx.clone()); } + self.highest_nonces.insert(tx.clone()); } /// Returns the ancestor the given transaction, the transaction with `nonce - 1`.