From 237f02e9c44a635d337ae19cbc5c23c7056c55f8 Mon Sep 17 00:00:00 2001 From: Soham Tomar Date: Thu, 23 Feb 2023 03:50:27 +0100 Subject: [PATCH 1/2] fix all the obvious clippy warnings --- crates/stages/src/stages/index_account_history.rs | 7 ++----- crates/stages/src/stages/index_storage_history.rs | 10 +++------- crates/storage/db/benches/criterion.rs | 6 +++--- crates/storage/db/benches/hash_keys.rs | 8 ++++---- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/crates/stages/src/stages/index_account_history.rs b/crates/stages/src/stages/index_account_history.rs index 5ff888019a2..aed7c1e410b 100644 --- a/crates/stages/src/stages/index_account_history.rs +++ b/crates/stages/src/stages/index_account_history.rs @@ -258,8 +258,7 @@ 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 +267,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 576ff0bd5c0..2effc61e959 100644 --- a/crates/stages/src/stages/index_storage_history.rs +++ b/crates/stages/src/stages/index_storage_history.rs @@ -282,8 +282,7 @@ 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 +291,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 +354,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 c0f73d160b9..2034f7df428 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 b7cb5929747..b372dca41fd 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 From 6612fa26fbb569053ba6c3067f385e41b0bbcc49 Mon Sep 17 00:00:00 2001 From: Soham Tomar Date: Fri, 24 Feb 2023 02:13:43 +0100 Subject: [PATCH 2/2] fmt changes --- crates/stages/src/stages/index_account_history.rs | 3 ++- crates/stages/src/stages/index_storage_history.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/stages/src/stages/index_account_history.rs b/crates/stages/src/stages/index_account_history.rs index aed7c1e410b..ccfda386f45 100644 --- a/crates/stages/src/stages/index_account_history.rs +++ b/crates/stages/src/stages/index_account_history.rs @@ -258,7 +258,8 @@ mod tests { } async fn run(tx: &TestTransaction, run_to: u64) { - let input = ExecInput { previous_stage: Some((PREV_STAGE_ID, run_to)), ..Default::default() }; + 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(); diff --git a/crates/stages/src/stages/index_storage_history.rs b/crates/stages/src/stages/index_storage_history.rs index 2effc61e959..efef9e065fe 100644 --- a/crates/stages/src/stages/index_storage_history.rs +++ b/crates/stages/src/stages/index_storage_history.rs @@ -282,7 +282,8 @@ mod tests { } async fn run(tx: &TestTransaction, run_to: u64) { - let input = ExecInput { previous_stage: Some((PREV_STAGE_ID, run_to)), ..Default::default() }; + 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();