diff --git a/Cargo.toml b/Cargo.toml index 1308361d4..936de53b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -206,6 +206,7 @@ zero_sized_map_values = "warn" single_char_pattern = "warn" needless_continue = "warn" enum_glob_use = "warn" +iter_without_into_iter = "warn" # These are nursery lints which have findings. Allow them for now. Some are not # quite mature enough for use in our codebase and some we don't really want. diff --git a/crates/primitives-traits/src/withdrawal.rs b/crates/primitives-traits/src/withdrawal.rs index 679c80cab..49d4e5e31 100644 --- a/crates/primitives-traits/src/withdrawal.rs +++ b/crates/primitives-traits/src/withdrawal.rs @@ -65,6 +65,23 @@ impl Withdrawals { } } +impl<'a> IntoIterator for &'a Withdrawals { + type Item = &'a Withdrawal; + type IntoIter = core::slice::Iter<'a, Withdrawal>; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a> IntoIterator for &'a mut Withdrawals { + type Item = &'a mut Withdrawal; + type IntoIter = core::slice::IterMut<'a, Withdrawal>; + + fn into_iter(self) -> Self::IntoIter { + self.iter_mut() + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/trie/trie/src/prefix_set/mod.rs b/crates/trie/trie/src/prefix_set/mod.rs index f6a8789e0..228e0abee 100644 --- a/crates/trie/trie/src/prefix_set/mod.rs +++ b/crates/trie/trie/src/prefix_set/mod.rs @@ -177,6 +177,14 @@ impl PrefixSet { } } +impl<'a> IntoIterator for &'a PrefixSet { + type IntoIter = std::slice::Iter<'a, reth_trie_common::Nibbles>; + type Item = &'a reth_trie_common::Nibbles; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + #[cfg(test)] mod tests { use super::*;