add explicit_iter_loop clippy lint (#8570)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Thomas Coratger
2024-06-03 20:14:50 +02:00
committed by GitHub
parent 6e446084f0
commit 2b4fa96065
47 changed files with 79 additions and 78 deletions

View File

@@ -29,7 +29,7 @@ impl ReceiptsLogPruneConfig {
/// Example:
///
/// `{ addrA: Before(872), addrB: Before(500), addrC: Distance(128) }`
///
///
/// for `tip: 1000`, gets transformed to a map such as:
///
/// `{ 500: [addrB], 872: [addrA, addrC] }`
@@ -46,7 +46,7 @@ impl ReceiptsLogPruneConfig {
let mut map = BTreeMap::new();
let pruned_block = pruned_block.unwrap_or_default();
for (address, mode) in self.0.iter() {
for (address, mode) in &self.0 {
// Getting `None`, means that there is nothing to prune yet, so we need it to include in
// the BTreeMap (block = 0), otherwise it will be excluded.
// Reminder that this BTreeMap works as an inclusion list that excludes (prunes) all
@@ -75,7 +75,7 @@ impl ReceiptsLogPruneConfig {
let pruned_block = pruned_block.unwrap_or_default();
let mut lowest = None;
for (_, mode) in self.0.iter() {
for mode in self.0.values() {
if let PruneMode::Distance(_) = mode {
if let Some((block, _)) =
mode.prune_target_block(tip, PruneSegment::ContractLogs, PrunePurpose::User)?

View File

@@ -31,7 +31,7 @@ impl Encodable for Requests {
let mut h = alloy_rlp::Header { list: true, payload_length: 0 };
let mut encoded = Vec::new();
for req in self.0.iter() {
for req in &self.0 {
let encoded_req = req.encoded_7685();
h.payload_length += encoded_req.len();
encoded.push(Bytes::from(encoded_req));

View File

@@ -737,7 +737,7 @@ mod tests {
&hex!("d30102808083c5cd02887dc5cdfd9e64fd9e407c56"),
];
for hex_data in input_too_short.iter() {
for hex_data in &input_too_short {
let input_rlp = &mut &hex_data[..];
let res = PooledTransactionsElement::decode(input_rlp);

View File

@@ -71,7 +71,7 @@ impl Compact for HashBuilderState {
buf.put_u16(self.stack.len() as u16);
len += 2;
for item in self.stack.iter() {
for item in &self.stack {
buf.put_u16(item.len() as u16);
buf.put_slice(&item[..]);
len += 2 + item.len();