From 72366d67b1f71c0f94277025dade0352e063880e Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Mon, 12 Aug 2024 16:04:10 +0300 Subject: [PATCH] fix: clippy errors Signed-off-by: Dori Medini --- Cargo.toml | 4 ++-- crates/blockifier/src/fee/actual_cost.rs | 2 +- crates/blockifier/src/state/cached_state_test.rs | 2 +- crates/native_blockifier/src/py_validator.rs | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7bc0e6ecb6..37861debb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,8 +54,8 @@ test-case = "2.2.2" thiserror = "1.0.37" [workspace.lints.rust] -warnings = "deny" future-incompatible = "deny" nonstandard-style = "deny" rust-2018-idioms = "deny" -unused = "deny" +unused = { level = "deny", priority = -1 } +warnings = "deny" diff --git a/crates/blockifier/src/fee/actual_cost.rs b/crates/blockifier/src/fee/actual_cost.rs index 7e53d50bca..4d51ccd67d 100644 --- a/crates/blockifier/src/fee/actual_cost.rs +++ b/crates/blockifier/src/fee/actual_cost.rs @@ -189,7 +189,7 @@ impl<'a> ActualCostBuilder<'a> { let bouncer_resources = actual_resources.clone(); // Add reverted steps to actual_resources' n_steps for correct fee charge. - *actual_resources.0.get_mut(&abi_constants::N_STEPS_RESOURCE.to_string()).unwrap() += + *actual_resources.0.get_mut(abi_constants::N_STEPS_RESOURCE).unwrap() += self.n_reverted_steps; let tx_info = &self.tx_context.tx_info; diff --git a/crates/blockifier/src/state/cached_state_test.rs b/crates/blockifier/src/state/cached_state_test.rs index a8467c43cb..c6a0bea482 100644 --- a/crates/blockifier/src/state/cached_state_test.rs +++ b/crates/blockifier/src/state/cached_state_test.rs @@ -390,7 +390,7 @@ fn global_contract_cache_is_used() { let mut state = CachedState::new(DictStateReader::default(), global_cache.clone()); // Assert local cache is initialized empty even if global cache is not empty. - assert!(state.class_hash_to_class.get(&class_hash).is_none()); + assert!(!state.class_hash_to_class.contains_key(&class_hash)); // Check state uses the global cache. assert_eq!(state.get_compiled_contract_class(class_hash).unwrap(), contract_class); diff --git a/crates/native_blockifier/src/py_validator.rs b/crates/native_blockifier/src/py_validator.rs index 5480014f03..2dcc84e4a1 100644 --- a/crates/native_blockifier/src/py_validator.rs +++ b/crates/native_blockifier/src/py_validator.rs @@ -31,6 +31,7 @@ pub struct PyValidator { #[pymethods] impl PyValidator { + #[allow(clippy::too_many_arguments)] #[new] #[pyo3(signature = (general_config, state_reader_proxy, next_block_info, validate_max_n_steps, invoke_max_n_steps, max_recursion_depth, global_contract_cache_size, max_nonce_for_validation_skip))] pub fn create(