diff options
author | Matthias Krüger <matthias.krueger@famsik.de> | 2017-11-19 17:26:06 +0100 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-11-22 10:50:28 -0500 |
commit | 7ae1f373c2b899c7db5f8106dec4d7423b1d8364 (patch) | |
tree | 2106b970d1fa6c20da9f807ed3c1f9dbf5fddb82 | |
parent | 4d34132365a00219f0c0baca9e05b119621dbd79 (diff) |
clippy: fix warnings about useless format call and remove references that would be immediately dereferenced by the compiler.
-rw-r--r-- | src/args.rs | 2 | ||||
-rw-r--r-- | src/printer.rs | 4 | ||||
-rw-r--r-- | 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<W: WriteColor> Printer<W> { 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<W: WriteColor> Printer<W> { } 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; } |