Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant calls to borrow() #1393

Merged
merged 6 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions substrate/client/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ pub mod utils {
return Ok(false)
}

let current = current.as_ref().map(|(c, p)| (c.borrow(), p.borrow()));

let mut hash = hash;
if let Some((current_hash, current_parent_hash)) = current {
if let Some((current_hash, current_parent_hash)) = current.as_ref() {
mrcnski marked this conversation as resolved.
Show resolved Hide resolved
if base == current_hash {
return Ok(false)
}
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/support/src/storage/generator/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl<K: FullEncode, V: FullCodec, G: StorageMap<K, V>> storage::StorageMap<K, V>
let ret = f(&mut val);
if ret.is_ok() {
match G::from_query_to_optional_value(val) {
Some(ref val) => unhashed::put(final_key.as_ref(), &val.borrow()),
Some(ref val) => unhashed::put(final_key.as_ref(), &val),
None => unhashed::kill(final_key.as_ref()),
}
}
Expand All @@ -314,7 +314,7 @@ impl<K: FullEncode, V: FullCodec, G: StorageMap<K, V>> storage::StorageMap<K, V>
let ret = f(&mut val);
if ret.is_ok() {
match val {
Some(ref val) => unhashed::put(final_key.as_ref(), &val.borrow()),
Some(ref val) => unhashed::put(final_key.as_ref(), &val),
None => unhashed::kill(final_key.as_ref()),
}
}
Expand Down