From 96b365c875fd858bafeb13510da14fffec6346b2 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 9 Feb 2024 16:38:56 -0800 Subject: [PATCH] walk_tree: use `mem::take` --- src/iter/walk_tree.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/iter/walk_tree.rs b/src/iter/walk_tree.rs index f743ca8c9..f7d6ca86d 100644 --- a/src/iter/walk_tree.rs +++ b/src/iter/walk_tree.rs @@ -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,