Skip to content

Commit 013eb51

Browse files
authored
chore(clippy): make clippy happy (#933)
1 parent 54e9b12 commit 013eb51

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

crates/stages/src/stages/hashing_account.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ mod tests {
235235
&self,
236236
blocks: Vec<SealedBlock>,
237237
) -> Result<(), TestRunnerError> {
238-
let mut blocks_iter = blocks.iter();
239-
while let Some(block) = blocks_iter.next() {
238+
for block in blocks.iter() {
240239
self.tx.commit(|tx| {
241240
insert_canonical_block(tx, block, true).unwrap();
242241
Ok(())
@@ -248,10 +247,9 @@ mod tests {
248247

249248
pub(crate) fn insert_accounts(
250249
&self,
251-
accounts: &Vec<(Address, Account)>,
250+
accounts: &[(Address, Account)],
252251
) -> Result<(), TestRunnerError> {
253-
let mut accs_iter = accounts.iter();
254-
while let Some((addr, acc)) = accs_iter.next() {
252+
for (addr, acc) in accounts.iter() {
255253
self.tx.commit(|tx| {
256254
tx.put::<tables::PlainAccountState>(*addr, *acc)?;
257255
Ok(())

crates/stages/src/stages/hashing_storage.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ mod tests {
294294

295295
self.tx.insert_headers(blocks.iter().map(|block| &block.header))?;
296296

297-
let mut iter = blocks.iter();
297+
let iter = blocks.iter();
298298
let (mut transition_id, mut tx_id) = (0, 0);
299299

300-
while let Some(progress) = iter.next() {
300+
for progress in iter {
301301
// Insert last progress data
302302
self.tx.commit(|tx| {
303303
let key: BlockNumHash = (progress.number, progress.hash()).into();
@@ -423,9 +423,9 @@ mod tests {
423423
let mut storage_cursor = tx.cursor_dup_write::<tables::PlainStorageState>()?;
424424
let prev_entry = storage_cursor
425425
.seek_by_key_subkey(tid_address.address(), entry.key)?
426-
.and_then(|e| {
426+
.map(|e| {
427427
storage_cursor.delete_current().expect("failed to delete entry");
428-
Some(e)
428+
e
429429
})
430430
.unwrap_or(StorageEntry { key: entry.key, value: U256::from(0) });
431431
if hash {

0 commit comments

Comments
 (0)