We can match for true/false instead of true/_

This commit is contained in:
Matthias Beyer 2016-03-24 12:30:31 +01:00
parent c12001a574
commit fc9c786df7

View file

@ -49,15 +49,15 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> EditResult<()> {
let exit_status = editor.arg(file_path).status(); let exit_status = editor.arg(file_path).status();
match exit_status.map(|s| s.success()) { match exit_status.map(|s| s.success()) {
Ok(true) => { Ok(true) => {
file.sync_data() file.sync_data()
.and_then(|_| file.seek(SeekFrom::Start(0))) .and_then(|_| file.seek(SeekFrom::Start(0)))
.and_then(|_| file.read_to_string(s)) .and_then(|_| file.read_to_string(s))
.map(|_| ()) .map(|_| ())
.map_err(|e| RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(e)))) .map_err(|e| RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(e))))
}, },
Ok(_) => Err(RuntimeError::new(RuntimeErrorKind::ProcessExitFailure, None)), Ok(false) => Err(RuntimeError::new(RuntimeErrorKind::ProcessExitFailure, None)),
Err(e) => Err(RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(e)))), Err(e) => Err(RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(e)))),
} }
} else { } else {
Err(RuntimeError::new(RuntimeErrorKind::Instantiate, None)) Err(RuntimeError::new(RuntimeErrorKind::Instantiate, None))