1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-15 01:32:25 +01:00

Fix all lints that are new with Rust 1.54

They are all of the following type:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
This commit is contained in:
Martin Nordholts
2021-08-18 20:37:38 +02:00
parent cbd96237fd
commit ed09f90e5e
7 changed files with 16 additions and 16 deletions

View File

@@ -372,19 +372,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
line_buffer: &[u8],
) -> Result<()> {
let line = if self.config.show_nonprintable {
replace_nonprintable(&line_buffer, self.config.tab_width)
replace_nonprintable(line_buffer, self.config.tab_width)
} else {
match self.content_type {
Some(ContentType::BINARY) | None => {
return Ok(());
}
Some(ContentType::UTF_16LE) => UTF_16LE
.decode(&line_buffer, DecoderTrap::Replace)
.decode(line_buffer, DecoderTrap::Replace)
.map_err(|_| "Invalid UTF-16LE")?,
Some(ContentType::UTF_16BE) => UTF_16BE
.decode(&line_buffer, DecoderTrap::Replace)
.decode(line_buffer, DecoderTrap::Replace)
.map_err(|_| "Invalid UTF-16BE")?,
_ => String::from_utf8_lossy(&line_buffer).to_string(),
_ => String::from_utf8_lossy(line_buffer).to_string(),
}
};
@@ -420,7 +420,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
let decorations = self
.decorations
.iter()
.map(|ref d| d.generate(line_number, false, self))
.map(|d| d.generate(line_number, false, self))
.collect::<Vec<_>>();
for deco in decorations {
@@ -531,7 +531,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
"{} ",
self.decorations
.iter()
.map(|ref d| d
.map(|d| d
.generate(line_number, true, self)
.text)
.collect::<Vec<String>>()