[Auto] bin/core/grep: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:40:13 +02:00 committed by Matthias Beyer
parent 1635dd4665
commit e2395b0474

View file

@ -95,9 +95,9 @@ fn main() {
.count(); .count();
if opts.count { if opts.count {
let _ = writeln!(rt.stdout(), "{}", count).to_exit_code().unwrap_or_exit(); writeln!(rt.stdout(), "{}", count).to_exit_code().unwrap_or_exit();
} else if !opts.files_with_matches { } else if !opts.files_with_matches {
let _ = writeln!(rt.stdout(), "Processed {} files, {} matches, {} nonmatches", writeln!(rt.stdout(), "Processed {} files, {} matches, {} nonmatches",
overall_count, overall_count,
count, count,
overall_count - count) overall_count - count)
@ -108,23 +108,23 @@ fn main() {
fn show(rt: &Runtime, e: &Entry, re: &Regex, opts: &Options, count: &mut usize) { fn show(rt: &Runtime, e: &Entry, re: &Regex, opts: &Options, count: &mut usize) {
if opts.files_with_matches { if opts.files_with_matches {
let _ = writeln!(rt.stdout(), "{}", e.get_location()).to_exit_code().unwrap_or_exit(); writeln!(rt.stdout(), "{}", e.get_location()).to_exit_code().unwrap_or_exit();
} else if opts.count { } else if opts.count {
*count += 1; *count += 1;
} else { } else {
let _ = writeln!(rt.stdout(), "{}:", e.get_location()).to_exit_code().unwrap_or_exit(); writeln!(rt.stdout(), "{}:", e.get_location()).to_exit_code().unwrap_or_exit();
for capture in re.captures_iter(e.get_content()) { for capture in re.captures_iter(e.get_content()) {
for mtch in capture.iter() { for mtch in capture.iter() {
if let Some(m) = mtch { if let Some(m) = mtch {
let _ = writeln!(rt.stdout(), " '{}'", m.as_str()).to_exit_code().unwrap_or_exit(); writeln!(rt.stdout(), " '{}'", m.as_str()).to_exit_code().unwrap_or_exit();
} }
} }
} }
let _ = writeln!(rt.stdout(), "").to_exit_code().unwrap_or_exit(); writeln!(rt.stdout()).to_exit_code().unwrap_or_exit();
*count += 1; *count += 1;
} }
let _ = rt.report_touched(e.get_location()).unwrap_or_exit(); rt.report_touched(e.get_location()).unwrap_or_exit();
} }