grep: Update for Rust 2018.

pull/13/head
Jim Blandy 3 years ago
parent 807b796c3b
commit 6a8541ad7f

@ -2,5 +2,6 @@
name = "grep"
version = "0.1.0"
authors = ["You <you@example.com>"]
edition = "2018"
[dependencies]

@ -18,7 +18,7 @@ fn grep<R>(target: &str, reader: R) -> io::Result<()>
Ok(())
}
fn grep_main() -> Result<(), Box<Error>> {
fn grep_main() -> Result<(), Box<dyn Error>> {
// 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<Error>> {
fn main() {
let result = grep_main();
if let Err(err) = result {
let _ = writeln!(io::stderr(), "{}", err);
eprintln!("{}", err);
std::process::exit(1);
}
}

Loading…
Cancel
Save