mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Use mem::take instead of mem::replace where appropriate (#5846)
* replace replace with take * Update client/api/src/cht.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/api/src/cht.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -114,7 +114,7 @@ impl<H, N, V> ForkTree<H, N, V> where
|
||||
)?;
|
||||
|
||||
let removed = if let Some(mut root_index) = new_root_index {
|
||||
let mut old_roots = std::mem::replace(&mut self.roots, Vec::new());
|
||||
let mut old_roots = std::mem::take(&mut self.roots);
|
||||
|
||||
let mut root = None;
|
||||
let mut cur_children = Some(&mut old_roots);
|
||||
@@ -137,7 +137,7 @@ impl<H, N, V> ForkTree<H, N, V> where
|
||||
|
||||
// we found the deepest ancestor of the finalized block, so we prune
|
||||
// out any children that don't include the finalized block.
|
||||
let root_children = std::mem::replace(&mut root.children, Vec::new());
|
||||
let root_children = std::mem::take(&mut root.children);
|
||||
let mut is_first = true;
|
||||
|
||||
for child in root_children {
|
||||
|
||||
Reference in New Issue
Block a user