diff --git a/crates/pi-uu-grep/src/rg.rs b/crates/pi-uu-grep/src/rg.rs index 9a8246354..be5199c7c 100644 --- a/crates/pi-uu-grep/src/rg.rs +++ b/crates/pi-uu-grep/src/rg.rs @@ -927,16 +927,11 @@ fn process_file( opts: &SearchOptions, out: &mut W, ) -> SearchOutcome { - match File::open(path) { - Ok(file) => match process_reader(matcher, searcher, file, display, opts, out) { - Ok(any_match) => SearchOutcome { any_match, had_error: false }, - Err(err) => SearchOutcome { - any_match: false, - had_error: report_path_error(display, path, err, opts), - }, - }, - Err(err) => { - SearchOutcome { any_match: false, had_error: report_path_error(display, path, err, opts) } + match File::open(path).and_then(|file| process_reader(matcher, searcher, file, display, opts, out)) { + Ok(any_match) => SearchOutcome { any_match, had_error: false }, + Err(err) => SearchOutcome { + any_match: false, + had_error: report_path_error(display, path, err, opts), }, } }