diff --git a/crates/stages/src/stages/hashing_account.rs b/crates/stages/src/stages/hashing_account.rs index 06b1e554058c..344d63b14026 100644 --- a/crates/stages/src/stages/hashing_account.rs +++ b/crates/stages/src/stages/hashing_account.rs @@ -235,8 +235,7 @@ mod tests { &self, blocks: Vec, ) -> Result<(), TestRunnerError> { - let mut blocks_iter = blocks.iter(); - while let Some(block) = blocks_iter.next() { + for block in blocks.iter() { self.tx.commit(|tx| { insert_canonical_block(tx, block, true).unwrap(); Ok(()) @@ -248,10 +247,9 @@ mod tests { pub(crate) fn insert_accounts( &self, - accounts: &Vec<(Address, Account)>, + accounts: &[(Address, Account)], ) -> Result<(), TestRunnerError> { - let mut accs_iter = accounts.iter(); - while let Some((addr, acc)) = accs_iter.next() { + for (addr, acc) in accounts.iter() { self.tx.commit(|tx| { tx.put::(*addr, *acc)?; Ok(()) diff --git a/crates/stages/src/stages/hashing_storage.rs b/crates/stages/src/stages/hashing_storage.rs index f902d1851fc3..043c6062aee0 100644 --- a/crates/stages/src/stages/hashing_storage.rs +++ b/crates/stages/src/stages/hashing_storage.rs @@ -294,10 +294,10 @@ mod tests { self.tx.insert_headers(blocks.iter().map(|block| &block.header))?; - let mut iter = blocks.iter(); + let iter = blocks.iter(); let (mut transition_id, mut tx_id) = (0, 0); - while let Some(progress) = iter.next() { + for progress in iter { // Insert last progress data self.tx.commit(|tx| { let key: BlockNumHash = (progress.number, progress.hash()).into(); @@ -423,9 +423,9 @@ mod tests { let mut storage_cursor = tx.cursor_dup_write::()?; let prev_entry = storage_cursor .seek_by_key_subkey(tid_address.address(), entry.key)? - .and_then(|e| { + .map(|e| { storage_cursor.delete_current().expect("failed to delete entry"); - Some(e) + e }) .unwrap_or(StorageEntry { key: entry.key, value: U256::from(0) }); if hash {