From 662fd87288bebee14762b4399b66ca0f55fb14a8 Mon Sep 17 00:00:00 2001 From: tomarST <46097541+tomarST@users.noreply.github.com> Date: Sun, 26 Feb 2023 05:10:52 -0330 Subject: [PATCH] chore: fix all the obvious clippy warnings (#1520) --- crates/stages/src/stages/index_account_history.rs | 8 +++----- crates/stages/src/stages/index_storage_history.rs | 11 ++++------- crates/storage/db/benches/criterion.rs | 6 +++--- crates/storage/db/benches/hash_keys.rs | 8 ++++---- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/crates/stages/src/stages/index_account_history.rs b/crates/stages/src/stages/index_account_history.rs index 5ff888019..ccfda386f 100644 --- a/crates/stages/src/stages/index_account_history.rs +++ b/crates/stages/src/stages/index_account_history.rs @@ -258,8 +258,8 @@ mod tests { } async fn run(tx: &TestTransaction, run_to: u64) { - let mut input = ExecInput::default(); - input.previous_stage = Some((PREV_STAGE_ID, run_to)); + let input = + ExecInput { previous_stage: Some((PREV_STAGE_ID, run_to)), ..Default::default() }; let mut stage = IndexAccountHistoryStage::default(); let mut tx = tx.inner(); let out = stage.execute(&mut tx, input).await.unwrap(); @@ -268,9 +268,7 @@ mod tests { } async fn unwind(tx: &TestTransaction, unwind_from: u64, unwind_to: u64) { - let mut input = UnwindInput::default(); - input.stage_progress = unwind_from; - input.unwind_to = unwind_to; + let input = UnwindInput { stage_progress: unwind_from, unwind_to, ..Default::default() }; let mut stage = IndexAccountHistoryStage::default(); let mut tx = tx.inner(); let out = stage.unwind(&mut tx, input).await.unwrap(); diff --git a/crates/stages/src/stages/index_storage_history.rs b/crates/stages/src/stages/index_storage_history.rs index 576ff0bd5..efef9e065 100644 --- a/crates/stages/src/stages/index_storage_history.rs +++ b/crates/stages/src/stages/index_storage_history.rs @@ -282,8 +282,8 @@ mod tests { } async fn run(tx: &TestTransaction, run_to: u64) { - let mut input = ExecInput::default(); - input.previous_stage = Some((PREV_STAGE_ID, run_to)); + let input = + ExecInput { previous_stage: Some((PREV_STAGE_ID, run_to)), ..Default::default() }; let mut stage = IndexStorageHistoryStage::default(); let mut tx = tx.inner(); let out = stage.execute(&mut tx, input).await.unwrap(); @@ -292,9 +292,7 @@ mod tests { } async fn unwind(tx: &TestTransaction, unwind_from: u64, unwind_to: u64) { - let mut input = UnwindInput::default(); - input.stage_progress = unwind_from; - input.unwind_to = unwind_to; + let input = UnwindInput { stage_progress: unwind_from, unwind_to, ..Default::default() }; let mut stage = IndexStorageHistoryStage::default(); let mut tx = tx.inner(); let out = stage.unwind(&mut tx, input).await.unwrap(); @@ -357,8 +355,7 @@ mod tests { async fn insert_index_to_full_shard() { // init let tx = TestTransaction::default(); - let mut input = ExecInput::default(); - input.previous_stage = Some((PREV_STAGE_ID, 5)); + let _input = ExecInput { previous_stage: Some((PREV_STAGE_ID, 5)), ..Default::default() }; // change does not matter only that account is present in changeset. let full_list = vec![3; NUM_OF_INDICES_IN_SHARD]; diff --git a/crates/storage/db/benches/criterion.rs b/crates/storage/db/benches/criterion.rs index c0f73d160..2034f7df4 100644 --- a/crates/storage/db/benches/criterion.rs +++ b/crates/storage/db/benches/criterion.rs @@ -147,7 +147,7 @@ where crsr.append(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); }, ) @@ -171,7 +171,7 @@ where crsr.insert(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); }, ) @@ -241,7 +241,7 @@ where crsr.append_dup(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); }, ) diff --git a/crates/storage/db/benches/hash_keys.rs b/crates/storage/db/benches/hash_keys.rs index b7cb59297..b372dca41 100644 --- a/crates/storage/db/benches/hash_keys.rs +++ b/crates/storage/db/benches/hash_keys.rs @@ -39,7 +39,7 @@ pub fn hash_keys(c: &mut Criterion) { group.sample_size(10); - for size in vec![10_000, 100_000, 1_000_000] { + for size in [10_000, 100_000, 1_000_000] { measure_table_insertion::(&mut group, size); } } @@ -176,7 +176,7 @@ where crsr.append(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); } db @@ -197,7 +197,7 @@ where crsr.insert(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); } db @@ -214,7 +214,7 @@ where tx.put::(k, v).expect("submit"); } - tx.inner.commit().unwrap(); + tx.inner.commit().unwrap() }); } db