Skip to content

Commit

Permalink
walk_tree: use mem::take
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Feb 10, 2024
1 parent 306748c commit 96b365c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/iter/walk_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ where
let right_children = split_vec(&mut self.to_explore);
let right = right_children
.map(|c| {
let mut right_seen = Vec::new();
std::mem::swap(&mut self.seen, &mut right_seen); // postfix -> upper nodes are processed last
let right_seen = std::mem::take(&mut self.seen); // postfix -> upper nodes are processed last
WalkTreePostfixProducer {
to_explore: c,
seen: right_seen,
Expand Down

0 comments on commit 96b365c

Please sign in to comment.