Skip to content

Commit

Permalink
Merge pull request #127 from Stebalien/chore/simplify
Browse files Browse the repository at this point in the history
replace mem::swap with mem::replace
  • Loading branch information
Stebalien authored Sep 27, 2020
2 parents 7209c2a + ac6a076 commit a362298
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 a362298

Please sign in to comment.