From 7ae1f373c2b899c7db5f8106dec4d7423b1d8364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 19 Nov 2017 17:26:06 +0100 Subject: [PATCH] clippy: fix warnings about useless format call and remove references that would be immediately dereferenced by the compiler. --- src/args.rs | 2 +- src/printer.rs | 4 ++-- src/search_buffer.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/args.rs b/src/args.rs index 5d2e6880..82f7ee66 100644 --- a/src/args.rs +++ b/src/args.rs @@ -601,7 +601,7 @@ impl<'a> ArgMatches<'a> { if self.is_present("no-line-number") || self.is_present("count") { false } else { - let only_stdin = paths == &[Path::new("-")]; + let only_stdin = paths == [Path::new("-")]; (atty::is(atty::Stream::Stdout) && !only_stdin) || self.is_present("line-number") || self.is_present("column") diff --git a/src/printer.rs b/src/printer.rs index d18d900f..37680f9b 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -397,7 +397,7 @@ impl Printer { self.line_number(line_number, b'-'); } if self.max_columns.map_or(false, |m| end - start > m) { - self.write(format!("[Omitted long context line]").as_bytes()); + self.write(b"[Omitted long context line]"); self.write_eol(); return; } @@ -408,7 +408,7 @@ impl Printer { } fn separator(&mut self, sep: &[u8]) { - self.write(&sep); + self.write(sep); } fn write_path_sep(&mut self, sep: u8) { diff --git a/src/search_buffer.rs b/src/search_buffer.rs index d2e3692a..11b561ea 100644 --- a/src/search_buffer.rs +++ b/src/search_buffer.rs @@ -113,7 +113,7 @@ impl<'a, W: WriteColor> BufferSearcher<'a, W> { #[inline(never)] pub fn run(mut self) -> u64 { - let binary_upto = cmp::min(10240, self.buf.len()); + let binary_upto = cmp::min(10_240, self.buf.len()); if !self.opts.text && is_binary(&self.buf[..binary_upto], true) { return 0; }