Use ? operator instead of try!() macro
This commit is contained in:
parent
82c30edcee
commit
26d7fd4eb7
1 changed files with 3 additions and 3 deletions
|
@ -27,11 +27,11 @@ use std::io::Error as IOError;
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
pub fn edit_in_tmpfile_with_command(mut cmd: Command, s: &mut String) -> Result<bool, IOError> {
|
pub fn edit_in_tmpfile_with_command(mut cmd: Command, s: &mut String) -> Result<bool, IOError> {
|
||||||
let mut file = &try!(NamedTempFile::new());
|
let mut file = &NamedTempFile::new()?;
|
||||||
let file_path = file.path();
|
let file_path = file.path();
|
||||||
|
|
||||||
try!(file.write_all(&s.clone().into_bytes()[..]));
|
file.write_all(&s.clone().into_bytes()[..])?;
|
||||||
try!(file.sync_data());
|
file.sync_data()?;
|
||||||
|
|
||||||
cmd.arg(file_path)
|
cmd.arg(file_path)
|
||||||
.status()
|
.status()
|
||||||
|
|
Loading…
Reference in a new issue