From 952fff0ee47bbcc5b391656018c086cbc062d32d Mon Sep 17 00:00:00 2001 From: arnavb11 Date: Fri, 11 Jan 2019 14:06:23 +0000 Subject: [PATCH] Use instead of for consistency --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 30c42dd..cdd6e91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -200,7 +200,7 @@ impl<'a> Printer<'a> { } } -fn run() -> io::Result<()> { +fn run() -> Result<(), Box<::std::error::Error>> { let app = App::new(crate_name!()) .setting(AppSettings::ColorAuto) .setting(AppSettings::ColoredHelp) @@ -218,7 +218,7 @@ fn run() -> io::Result<()> { .help("read only N bytes from the input"), ); - let matches = app.get_matches(); + let matches = app.get_matches_safe()?; let stdin = io::stdin(); @@ -270,7 +270,9 @@ fn main() { let result = run(); match result { Err(err) => { - eprintln!("Error: {}", 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(()) => {}