mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Refactor error handling into a if-let
This commit is contained in:
1 parent
952fff0ee4
commit
866feb2966
1 file changed
+6
-8
+6
-8
@@ -268,13 +268,11 @@ fn main() {
|
|||||||
let _ = ansi_term::enable_ansi_support();
|
let _ = ansi_term::enable_ansi_support();
|
||||||
|
|
||||||
let result = run();
|
let result = run();
|
||||||
match result {
|
|
||||||
Err(err) => {
|
if let Err(err) = result {
|
||||||
// The whitespace is being removed from the right because
|
// The whitespace is being removed from the right because
|
||||||
// clap errors add a newline to the end of the output already
|
// clap errors add a newline to the end of the output already
|
||||||
eprintln!("Error: {}", format!("{}", err).trim_right());
|
eprintln!("Error: {}", format!("{}", err).trim_right());
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
|
||||||
Ok(()) => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user