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

@ -61,7 +61,7 @@ fn txpool_reordering_bench<T: BenchTxPool>(
let mut txpool = T::default();
txpool.reorder(base_fee);
for tx in seed.iter() {
for tx in &seed {
txpool.add_transaction(tx.clone());
}
(txpool, new_txs.clone())

View File

@ -142,7 +142,7 @@ fn truncate_pending(
let mut txpool = PendingPool::new(MockOrdering::default());
let mut f = MockTransactionFactory::default();
for tx in seed.iter() {
for tx in &seed {
// add transactions with a basefee of zero, so they are not immediately removed
txpool.add_transaction(f.validated_arc(tx.clone()), 0);
}
@ -177,7 +177,7 @@ fn truncate_queued(
let mut txpool = ParkedPool::<QueuedOrd<_>>::default();
let mut f = MockTransactionFactory::default();
for tx in seed.iter() {
for tx in &seed {
txpool.add_transaction(f.validated_arc(tx.clone()));
}
txpool
@ -211,7 +211,7 @@ fn truncate_basefee(
let mut txpool = ParkedPool::<BasefeeOrd<_>>::default();
let mut f = MockTransactionFactory::default();
for tx in seed.iter() {
for tx in &seed {
txpool.add_transaction(f.validated_arc(tx.clone()));
}
txpool

View File

@ -645,7 +645,7 @@ mod tests {
})
.collect::<Vec<_>>();
for tx in txs.iter() {
for tx in &txs {
pool.add_transaction(factory.validated_arc(tx.clone()));
}

View File

@ -530,7 +530,7 @@ where
// It may happen that a newly added transaction is immediately discarded, so we need to
// adjust the result here
for res in added.iter_mut() {
for res in &mut added {
if let Ok(hash) = res {
if discarded.contains(hash) {
*res = Err(PoolError::new(*hash, PoolErrorKind::DiscardedOnInsert))

View File

@ -403,7 +403,7 @@ impl<T: TransactionOrdering> PendingPool<T> {
removed.clear();
// loop through the highest nonces set, removing transactions until we reach the limit
for tx in self.highest_nonces.iter() {
for tx in &self.highest_nonces {
// return early if the pool is under limits
if !limit.is_exceeded(original_length - total_removed, original_size - total_size) ||
non_local_senders == 0

View File

@ -413,7 +413,7 @@ impl<T: TransactionOrdering> TxPool<T> {
self.all_transactions.set_block_info(block_info);
// Remove all transaction that were included in the block
for tx_hash in mined_transactions.iter() {
for tx_hash in &mined_transactions {
if self.prune_transaction_by_hash(tx_hash).is_some() {
// Update removed transactions metric
self.metrics.removed_transactions.increment(1);
@ -2173,7 +2173,7 @@ mod tests {
// dedup the test cases
let expected_promotions = expected_promotions.into_iter().collect::<HashSet<_>>();
for promotion_test in expected_promotions.iter() {
for promotion_test in &expected_promotions {
let mut pool = TxPool::new(MockOrdering::default(), Default::default());
// set block info so the tx is initially underpriced w.r.t. blob fee

View File

@ -1504,7 +1504,7 @@ impl MockTransactionSet {
assert!(gap_range.start >= 1, "gap_range must have a lower bound of at least one");
let mut prev_nonce = 0;
for tx in self.transactions.iter_mut() {
for tx in &mut self.transactions {
if rng.gen_bool(gap_pct as f64 / 100.0) {
prev_nonce += gap_range.start;
} else {