mirror of
https://github.com/uutils/grep.git
synced 2026-06-10 16:15:11 -07:00
grep: Simplify session_finalize
This commit is contained in:
+13
-12
@@ -643,18 +643,19 @@ impl<'a> Searcher<'a> {
|
||||
|
||||
/// End-of-file bookkeeping: count / `-L` / binary notice.
|
||||
fn session_finalize(&mut self, path: &Path) -> io::Result<bool> {
|
||||
if self.config.quiet {
|
||||
return Ok(self.session_any_match());
|
||||
}
|
||||
if self.config.count && !self.config.files_with_matches && !self.config.files_without_match
|
||||
{
|
||||
self.writer.write_count(self.session_match_count, path)?;
|
||||
}
|
||||
if self.config.files_without_match && !self.session_any_match() {
|
||||
self.writer.write_filename(path)?;
|
||||
}
|
||||
if self.session_should_emit_binary_notice() {
|
||||
self.writer.report_binary_match(path);
|
||||
if !self.config.quiet {
|
||||
if self.config.count
|
||||
&& !self.config.files_with_matches
|
||||
&& !self.config.files_without_match
|
||||
{
|
||||
self.writer.write_count(self.session_match_count, path)?;
|
||||
}
|
||||
if self.config.files_without_match && !self.session_any_match() {
|
||||
self.writer.write_filename(path)?;
|
||||
}
|
||||
if self.session_should_emit_binary_notice() {
|
||||
self.writer.report_binary_match(path);
|
||||
}
|
||||
}
|
||||
Ok(self.session_any_match())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user