Use mem::replace instead of mem::swap when it's cleaner.

This commit is contained in:
Dan Gohman
2017-09-05 13:55:33 -07:00
parent 0ac1d0dd94
commit d3712575b5
2 changed files with 3 additions and 6 deletions

View File

@@ -132,8 +132,7 @@ impl CheckerBuilder {
pub fn finish(&mut self) -> Checker {
// Move directives into the new checker, leaving `self.directives` empty and ready for
// building a new checker.
let mut new_directives = Vec::new();
mem::swap(&mut new_directives, &mut self.directives);
let new_directives = mem::replace(&mut self.directives, Vec::new());
Checker::new(new_directives)
}
}