mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-28 08:05:52 +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 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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user