Skip to content

Commit dc4d38f

Browse files
authored
perf(CacheAccount): remove unneeded clone (#1859)
1 parent bbc8d81 commit dc4d38f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/database/src/states/cache_account.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,11 @@ impl CacheAccount {
282282
storage: StorageWithOriginalValues,
283283
) -> TransitionAccount {
284284
let previous_status = self.status;
285-
let previous_info = self.account.as_ref().map(|a| a.info.clone());
286-
let mut this_storage = self
287-
.account
288-
.take()
289-
.map(|acc| acc.storage)
290-
.unwrap_or_default();
285+
let (previous_info, mut this_storage) = if let Some(account) = self.account.take() {
286+
(Some(account.info), account.storage)
287+
} else {
288+
(None, Default::default())
289+
};
291290

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

0 commit comments

Comments
 (0)