diff --git a/bin/reth/src/commands/test_vectors/tables.rs b/bin/reth/src/commands/test_vectors/tables.rs index 2fa4f760f8..15e0c0394d 100644 --- a/bin/reth/src/commands/test_vectors/tables.rs +++ b/bin/reth/src/commands/test_vectors/tables.rs @@ -73,10 +73,11 @@ pub(crate) fn generate_vectors(mut tables: Vec) -> Result<()> { } /// Generates test-vectors for normal tables. Keys are sorted and not repeated. -fn generate_table_vector(runner: &mut TestRunner, per_table: usize) -> Result<()> +fn generate_table_vector(runner: &mut TestRunner, per_table: usize) -> Result<()> where T::Key: Arbitrary + serde::Serialize + Ord + std::hash::Hash, T::Value: Arbitrary + serde::Serialize, + T: Table, { let mut rows = vec![]; let mut seen_keys = HashSet::new(); @@ -109,9 +110,9 @@ where /// Generates test-vectors for DUPSORT tables. Each key has multiple (subkey, value). Keys and /// subkeys are sorted. -fn generate_dupsort_vector(runner: &mut TestRunner, per_table: usize) -> Result<()> +fn generate_dupsort_vector(runner: &mut TestRunner, per_table: usize) -> Result<()> where - T: DupSort, + T: Table + DupSort, T::Key: Arbitrary + serde::Serialize + Ord + std::hash::Hash, T::Value: Arbitrary + serde::Serialize + Ord, { diff --git a/crates/blockchain-tree/src/block_buffer.rs b/crates/blockchain-tree/src/block_buffer.rs index cbdc692b58..23c6ca6815 100644 --- a/crates/blockchain-tree/src/block_buffer.rs +++ b/crates/blockchain-tree/src/block_buffer.rs @@ -215,7 +215,7 @@ mod tests { /// Assert that the block was removed from all buffer collections. fn assert_block_removal(buffer: &BlockBuffer, block: &SealedBlockWithSenders) { - assert!(buffer.blocks.get(&block.hash()).is_none()); + assert!(!buffer.blocks.contains_key(&block.hash())); assert!(buffer .parent_to_child .get(&block.parent_hash) diff --git a/crates/net/network/src/cache.rs b/crates/net/network/src/cache.rs index 3a18d67450..c7fa271f1c 100644 --- a/crates/net/network/src/cache.rs +++ b/crates/net/network/src/cache.rs @@ -62,10 +62,10 @@ impl LruCache { } /// Returns `true` if the set contains a value. - pub fn contains(&self, value: &Q) -> bool + pub fn contains(&self, value: &Q) -> bool where T: Borrow, - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, { self.inner.contains(value) } diff --git a/crates/net/network/src/peers/manager.rs b/crates/net/network/src/peers/manager.rs index 4210cb029e..35c39c5c9c 100644 --- a/crates/net/network/src/peers/manager.rs +++ b/crates/net/network/src/peers/manager.rs @@ -1715,7 +1715,7 @@ mod tests { }) .await; - assert!(peers.peers.get(&peer).is_none()); + assert!(!peers.peers.contains_key(&peer)); } #[tokio::test] @@ -1770,7 +1770,7 @@ mod tests { }) .await; - assert!(peers.peers.get(&peer).is_none()); + assert!(!peers.peers.contains_key(&peer)); } #[tokio::test] @@ -1826,7 +1826,7 @@ mod tests { }) .await; - assert!(peers.peers.get(&peer).is_none()); + assert!(!peers.peers.contains_key(&peer)); } #[tokio::test] @@ -1991,7 +1991,7 @@ mod tests { assert_eq!(p.state, PeerConnectionState::DisconnectingOut); peers.on_active_session_gracefully_closed(peer); - assert!(peers.peers.get(&peer).is_none()); + assert!(!peers.peers.contains_key(&peer)); } #[tokio::test] @@ -2240,7 +2240,7 @@ mod tests { assert!(peer.remove_after_disconnect); peers.on_active_session_gracefully_closed(peer_id); - assert!(peers.peers.get(&peer_id).is_none()) + assert!(!peers.peers.contains_key(&peer_id)) } #[tokio::test] diff --git a/crates/storage/provider/src/chain.rs b/crates/storage/provider/src/chain.rs index b5289fc6dd..d7cb4cbac2 100644 --- a/crates/storage/provider/src/chain.rs +++ b/crates/storage/provider/src/chain.rs @@ -110,7 +110,7 @@ impl Chain { return Some(self.state.clone()) } - if self.blocks.get(&block_number).is_some() { + if self.blocks.contains_key(&block_number) { let mut state = self.state.clone(); state.revert_to(block_number); return Some(state) diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 90e0c6a3c1..28ea3a61ad 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -685,7 +685,7 @@ where } /// Removes and returns all transactions that are present in the pool. - pub(crate) fn retain_unknown(&self, announcement: &mut A) + pub(crate) fn retain_unknown(&self, announcement: &mut A) where A: HandleMempoolData, {