clippy: add needless_for_each clippy lint (#10555)

Co-authored-by: Oliver <onbjerg@users.noreply.github.com>
This commit is contained in:
Thomas Coratger
2024-08-27 03:31:44 -07:00
committed by GitHub
parent 1d07ff72e9
commit f6f16fcd9c
5 changed files with 9 additions and 8 deletions

View File

@ -220,6 +220,7 @@ zero_sized_map_values = "warn"
implicit_clone = "warn"
cloned_instead_of_copied = "warn"
option_as_ref_cloned = "warn"
needless_for_each = "warn"
manual_is_variant_and = "warn"
# These are nursery lints which have findings. Allow them for now. Some are not

View File

@ -72,10 +72,10 @@ async fn test_4844_tx_gossip_penalization() {
// peer 0 will be penalised for sending txs[0] over gossip
let txs = vec![gen.gen_eip4844_pooled(), gen.gen_eip1559_pooled()];
txs.iter().for_each(|tx| {
for tx in &txs {
let sender = tx.sender();
provider.add_account(sender, ExtendedAccount::new(0, U256::from(100_000_000)));
});
}
let signed_txs: Vec<Arc<TransactionSigned>> =
txs.iter().map(|tx| Arc::new(tx.transaction().clone().into_signed())).collect();

View File

@ -598,7 +598,7 @@ mod tests {
.collect::<Vec<Vec<_>>>();
let last_chunk = chunks.pop();
chunks.into_iter().for_each(|list| {
for list in chunks {
result.insert(
ShardedKey::new(
address,
@ -607,7 +607,7 @@ mod tests {
),
list,
);
});
}
if let Some(last_list) = last_chunk {
result.insert(ShardedKey::new(address, u64::MAX), last_list);

View File

@ -624,7 +624,7 @@ mod tests {
.collect::<Vec<Vec<_>>>();
let last_chunk = chunks.pop();
chunks.into_iter().for_each(|list| {
for list in chunks {
result.insert(
StorageShardedKey::new(
partial_key.0,
@ -634,7 +634,7 @@ mod tests {
),
list,
);
});
}
if let Some(last_list) = last_chunk {
result.insert(

View File

@ -291,10 +291,10 @@ mod tests {
static_file_writer.commit().expect("prune headers");
let tx = db.factory.db_ref().tx_mut().expect("init tx");
blocks.iter().for_each(|block| {
for block in &blocks {
TestStageDB::insert_header(None, &tx, &block.header, U256::ZERO)
.expect("insert block header");
});
}
tx.commit().expect("commit tx");
let mut receipts = Vec::new();