Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
remove clippy allow
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelabro committed Jan 10, 2024
1 parent 014b4a8 commit 21f98cb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/blockifier/src/state/cached_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,21 @@ impl<S: StateReader> StateReader for CachedState<S> {
Ok(*class_hash)
}

#[allow(clippy::map_entry)]
// Clippy solution don't work because it required two mutable ref to self
// Could probably be solved with interior mutability
fn get_compiled_contract_class(&self, class_hash: ClassHash) -> StateResult<ContractClass> {
let class_hash_to_class = &mut *self.class_hash_to_class.borrow_mut();

if !class_hash_to_class.contains_key(&class_hash) {
if let std::collections::hash_map::Entry::Vacant(e) = class_hash_to_class.entry(class_hash)
{
let contract_class = self.global_class_hash_to_class().cache_get(&class_hash).cloned();

match contract_class {
Some(contract_class_from_global_cache) => {
class_hash_to_class.insert(class_hash, contract_class_from_global_cache);
e.insert(contract_class_from_global_cache);
}
None => {
let contract_class_from_db =
self.state.get_compiled_contract_class(class_hash)?;
class_hash_to_class.insert(class_hash, contract_class_from_db);
e.insert(contract_class_from_db);
}
}
}
Expand Down

0 comments on commit 21f98cb

Please sign in to comment.