File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 22name = " grep"
33version = " 0.1.0"
44authors = [" You <you@example.com>" ]
5+ edition = " 2018"
56
67[dependencies ]
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ fn grep<R>(target: &str, reader: R) -> io::Result<()>
1818 Ok ( ( ) )
1919}
2020
21- fn grep_main ( ) -> Result < ( ) , Box < Error > > {
21+ fn grep_main ( ) -> Result < ( ) , Box < dyn Error > > {
2222 // Get the command-line arguments. The first argument is the
2323 // string to search for; the rest are filenames.
2424 let mut args = std:: env:: args ( ) . skip ( 1 ) ;
@@ -44,6 +44,7 @@ fn grep_main() -> Result<(), Box<Error>> {
4444fn main ( ) {
4545 let result = grep_main ( ) ;
4646 if let Err ( err) = result {
47- let _ = writeln ! ( io:: stderr( ) , "{}" , err) ;
47+ eprintln ! ( "{}" , err) ;
48+ std:: process:: exit ( 1 ) ;
4849 }
4950}
You can’t perform that action at this time.
0 commit comments