diff --git a/src/cat.rs b/src/cat.rs index 300e344..9bfa59c 100644 --- a/src/cat.rs +++ b/src/cat.rs @@ -53,11 +53,7 @@ fn main() -> ExitCode { if path == "-" { loop { match io::stdin().lock().read_line(&mut output) { - Ok(EOF) => { - print!("{}", output); - output.clear(); - if EOF == 0 { break } - }, + Ok(EOF) => if EOF == 0 { break }, Err(_) => { eprintln!("Usage: {} [options...] [files...]", &argv0); return ExitCode::Usage; @@ -66,13 +62,15 @@ fn main() -> ExitCode { } } else { match read_to_string(&path) { - Ok(output) => print!("{}", output), + Ok(output) => {}, Err(_) => { eprintln!("{}: {}: No such file or directory.", &argv0, &path); return ExitCode::NoInput; }, }; } + print!("{}", output); + output.clear(); } match io::stdout().flush() { Ok(_) => return ExitCode::Ok,