diff --git a/grep/Cargo.toml b/grep/Cargo.toml index 14dc747..d228cc7 100644 --- a/grep/Cargo.toml +++ b/grep/Cargo.toml @@ -2,5 +2,6 @@ name = "grep" version = "0.1.0" authors = ["You "] +edition = "2018" [dependencies] diff --git a/grep/src/main.rs b/grep/src/main.rs index e6a128a..be67bc5 100644 --- a/grep/src/main.rs +++ b/grep/src/main.rs @@ -18,7 +18,7 @@ fn grep(target: &str, reader: R) -> io::Result<()> Ok(()) } -fn grep_main() -> Result<(), Box> { +fn grep_main() -> Result<(), Box> { // Get the command-line arguments. The first argument is the // string to search for; the rest are filenames. let mut args = std::env::args().skip(1); @@ -44,6 +44,7 @@ fn grep_main() -> Result<(), Box> { fn main() { let result = grep_main(); if let Err(err) = result { - let _ = writeln!(io::stderr(), "{}", err); + eprintln!("{}", err); + std::process::exit(1); } }