summaryrefslogtreecommitdiffstats
path: root/libimagutil
diff options
context:
space:
mode:
authorSteven Allen <steven@stebalien.com>2016-11-03 20:21:31 -0700
committerSteven Allen <steven@stebalien.com>2016-11-03 20:21:31 -0700
commitc02d7693b24a37c6bc02beccefe1803e34adbac2 (patch)
treea0da80bf4f4f26c48101ed07077457020f775444 /libimagutil
parente70fdc63c8f566039cf3f1afa910fa1a47430415 (diff)
Don't re-open temporary file.
`Write` is implemented on both `&NamedTemporaryFile` and `&File` so you don't actually need a mutable reference. I wish there were a better way to do this but such is life.
Diffstat (limited to 'libimagutil')
-rw-r--r--libimagutil/src/edit.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/libimagutil/src/edit.rs b/libimagutil/src/edit.rs
index 3cf459f4..5d1838fc 100644
--- a/libimagutil/src/edit.rs
+++ b/libimagutil/src/edit.rs
@@ -27,9 +27,8 @@ use std::io::Error as IOError;
use tempfile::NamedTempFile;
pub fn edit_in_tmpfile_with_command(mut cmd: Command, s: &mut String) -> Result<bool, IOError> {
- let file = try!(NamedTempFile::new());
+ let mut file = &try!(NamedTempFile::new());
let file_path = file.path();
- let mut file = try!(file.reopen());
try!(file.write_all(&s.clone().into_bytes()[..]));
try!(file.sync_data());