Refactor error handling into a if-let

This commit is contained in:
arnavb11 authored and David Peter committed 2019-01-13 18:03:07 +01:00
1 parent 952fff0ee4
commit 866feb2966
1 file changed
+6 -8
+6 -8
View File
@@ -268,13 +268,11 @@ fn main() {
let _ = ansi_term::enable_ansi_support();
let result = run();
match result {
Err(err) => {
// The whitespace is being removed from the right because
// clap errors add a newline to the end of the output already
eprintln!("Error: {}", format!("{}", err).trim_right());
std::process::exit(1);
}
Ok(()) => {}
if let Err(err) = result {
// The whitespace is being removed from the right because
// clap errors add a newline to the end of the output already
eprintln!("Error: {}", format!("{}", err).trim_right());
std::process::exit(1);
}
}