Skip to content

Commit

Permalink
perf(CacheAccount): remove unneeded clone
Browse files Browse the repository at this point in the history
  • Loading branch information
hai-rise committed Nov 19, 2024
1 parent 900409f commit d93ed7e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/revm/src/db/states/cache_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,11 @@ impl CacheAccount {
storage: StorageWithOriginalValues,
) -> TransitionAccount {
let previous_status = self.status;
let previous_info = self.account.as_ref().map(|a| a.info.clone());
let mut this_storage = self
.account
.take()
.map(|acc| acc.storage)
.unwrap_or_default();
let (previous_info, mut this_storage) = if let Some(account) = self.account.take() {
(Some(account.info), account.storage)
} else {
(None, Default::default())
};

this_storage.extend(storage.iter().map(|(k, s)| (*k, s.present_value)));
let changed_account = PlainAccount {
Expand Down

0 comments on commit d93ed7e

Please sign in to comment.