From a84713543dad8d34239406cd0e44b55649ac9f3a Mon Sep 17 00:00:00 2001 From: jjy Date: Tue, 1 Nov 2022 22:11:06 +0800 Subject: [PATCH] chore: fix cargo clippy warning --- .../benches/benches/benchmarks/dummy_state.rs | 56 ------------------- crates/benches/benches/benchmarks/mod.rs | 1 - crates/benches/benches/benchmarks/smt.rs | 13 ++--- crates/benches/benches/benchmarks/sudt.rs | 30 +++++++--- crates/store/src/tests/state_db.rs | 2 +- crates/tests/src/testing_tool/chain.rs | 2 +- crates/tests/src/tests/meta_contract_args.rs | 2 +- .../src/tests/polyjuice_sender_recover.rs | 2 +- .../tests/rpc_server/execute_l2transaction.rs | 12 ++-- .../block_max_cycles_limit.rs | 2 +- .../rpc_server/execute_raw_l2transaction.rs | 8 +-- .../block_max_cycles_limit.rs | 4 +- .../tests/rpc_server/submit_l2transaction.rs | 16 +++--- 13 files changed, 54 insertions(+), 96 deletions(-) delete mode 100644 crates/benches/benches/benchmarks/dummy_state.rs diff --git a/crates/benches/benches/benchmarks/dummy_state.rs b/crates/benches/benches/benchmarks/dummy_state.rs deleted file mode 100644 index 902bb9ee2..000000000 --- a/crates/benches/benches/benchmarks/dummy_state.rs +++ /dev/null @@ -1,56 +0,0 @@ -use gw_common::{ - error::Error, - smt::{default_store::DefaultStore, H256, SMT}, - state::State, -}; -use gw_traits::CodeStore; -use gw_types::{bytes::Bytes, packed::Script}; -use std::collections::HashMap; - -#[derive(Default)] -pub struct DummyState { - tree: SMT>, - account_count: u32, - scripts: HashMap, - codes: HashMap, -} - -impl State for DummyState { - fn get_raw(&self, key: &H256) -> Result { - let v = self.tree.get(key)?; - Ok(v) - } - fn update_raw(&mut self, key: H256, value: H256) -> Result<(), Error> { - self.tree.update(key, value)?; - Ok(()) - } - fn finalise(&mut self) -> Result<(), Error> { - Err(Error::Store) - } - fn calculate_root(&self) -> Result { - let root = *self.tree.root(); - Ok(root) - } - fn get_account_count(&self) -> Result { - Ok(self.account_count) - } - fn set_account_count(&mut self, count: u32) -> Result<(), Error> { - self.account_count = count; - Ok(()) - } -} - -impl CodeStore for DummyState { - fn insert_script(&mut self, script_hash: H256, script: Script) { - self.scripts.insert(script_hash, script); - } - fn get_script(&self, script_hash: &H256) -> Option