Skip to content

Commit

Permalink
replace mem::swap with mem::replace
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Sep 26, 2020
1 parent eb083d7 commit ac6a076
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/file/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std;
use std::env;
use std::error;
use std::ffi::OsStr;
Expand Down Expand Up @@ -342,8 +341,7 @@ impl TempPath {
// Don't drop `self`. We don't want to try deleting the old
// temporary file path. (It'll fail, but the failure is never
// seen.)
let mut path = PathBuf::new();
mem::swap(&mut self.path, &mut path);
let path = mem::replace(&mut self.path, PathBuf::new());
mem::forget(self);
Ok(path)
}
Expand Down

0 comments on commit ac6a076

Please sign in to comment.