on master help sign in
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

commited09f90e5e3b0b2bed93a591157b8b3a73e07ef8 authorMartin Nordholts <enselic@gmail.com> dateWed 18 Aug 2021, 20:37 (5 years ago) parentcbd9623
7 files changed+16−16
src/assets.rs+1−1 src/bin/bat/app.rs+1−1 src/bin/bat/assets.rs+2−2 src/bin/bat/main.rs+1−1 src/controller.rs+4−4 src/input.rs+1−1 src/printer.rs+6−6
src/assets.rs+1−1
@@ -408,7 +408,7 @@ impl SerializedSyntaxSet {
408408 fn deserialize(&self) -> Result<SyntaxSet> {
409409 match self {
410410 SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data)),
411− SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(&path, "syntax set"),
411+ SerializedSyntaxSet::FromFile(ref path) => asset_from_cache(path, "syntax set"),
412412 }
413413 }
414414}
src/bin/bat/app.rs+1−1
@@ -301,7 +301,7 @@ impl App {
301301 .map(|style_str| {
302302 style_str
303303 .split(',')
304− .map(|x| StyleComponent::from_str(&x))
304+ .map(|x| StyleComponent::from_str(x))
305305 .collect::<Result<Vec<StyleComponent>>>()
306306 })
307307 .transpose()?;
src/bin/bat/assets.rs+2−2
@@ -25,7 +25,7 @@ pub fn clear_assets() {
2525
2626pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
2727 let cache_dir = PROJECT_DIRS.cache_dir();
28− if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
28+ if let Some(metadata) = AssetsMetadata::load_from_folder(cache_dir)? {
2929 if !metadata.is_compatible_with(crate_version!()) {
3030 return Err(format!(
3131 "The binary caches for the user-customized syntaxes and themes \
@@ -42,7 +42,7 @@ pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<Highlighti
4242 }
4343
4444 let custom_assets = if use_custom_assets {
45− HighlightingAssets::from_cache(&cache_dir).ok()
45+ HighlightingAssets::from_cache(cache_dir).ok()
4646 } else {
4747 None
4848 };
src/bin/bat/main.rs+1−1
@@ -226,7 +226,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
226226
227227fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
228228 let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
229− let controller = Controller::new(&config, &assets);
229+ let controller = Controller::new(config, &assets);
230230 controller.run(inputs)
231231}
232232
src/controller.rs+4−4
@@ -45,7 +45,7 @@ impl<'b> Controller<'b> {
4545 // Do not launch the pager if NONE of the input files exist
4646 let mut paging_mode = self.config.paging_mode;
4747 if self.config.paging_mode != PagingMode::Never {
48− let call_pager = inputs.iter().any(|ref input| {
48+ let call_pager = inputs.iter().any(|input| {
4949 if let InputKind::OrdinaryFile(ref path) = input.kind {
5050 Path::new(path).exists()
5151 } else {
@@ -124,11 +124,11 @@ impl<'b> Controller<'b> {
124124 };
125125
126126 let mut printer: Box<dyn Printer> = if self.config.loop_through {
127− Box::new(SimplePrinter::new(&self.config))
127+ Box::new(SimplePrinter::new(self.config))
128128 } else {
129129 Box::new(InteractivePrinter::new(
130− &self.config,
131− &self.assets,
130+ self.config,
131+ self.assets,
132132 &mut opened_input,
133133 #[cfg(feature = "git")]
134134 &line_changes,
src/input.rs+1−1
@@ -51,7 +51,7 @@ impl InputDescription {
5151
5252 pub fn title(&self) -> &String {
5353 match self.title.as_ref() {
54− Some(ref title) => title,
54+ Some(title) => title,
5555 None => &self.name,
5656 }
5757 }
src/printer.rs+6−6
@@ -372,19 +372,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
372372 line_buffer: &[u8],
373373 ) -> Result<()> {
374374 let line = if self.config.show_nonprintable {
375− replace_nonprintable(&line_buffer, self.config.tab_width)
375+ replace_nonprintable(line_buffer, self.config.tab_width)
376376 } else {
377377 match self.content_type {
378378 Some(ContentType::BINARY) | None => {
379379 return Ok(());
380380 }
381381 Some(ContentType::UTF_16LE) => UTF_16LE
382− .decode(&line_buffer, DecoderTrap::Replace)
382+ .decode(line_buffer, DecoderTrap::Replace)
383383 .map_err(|_| "Invalid UTF-16LE")?,
384384 Some(ContentType::UTF_16BE) => UTF_16BE
385− .decode(&line_buffer, DecoderTrap::Replace)
385+ .decode(line_buffer, DecoderTrap::Replace)
386386 .map_err(|_| "Invalid UTF-16BE")?,
387− _ => String::from_utf8_lossy(&line_buffer).to_string(),
387+ _ => String::from_utf8_lossy(line_buffer).to_string(),
388388 }
389389 };
390390
@@ -420,7 +420,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
420420 let decorations = self
421421 .decorations
422422 .iter()
423− .map(|ref d| d.generate(line_number, false, self))
423+ .map(|d| d.generate(line_number, false, self))
424424 .collect::<Vec<_>>();
425425
426426 for deco in decorations {
@@ -531,7 +531,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
531531 "{} ",
532532 self.decorations
533533 .iter()
534− .map(|ref d| d
534+ .map(|d| d
535535 .generate(line_number, true, self)
536536 .text)
537537 .collect::<Vec<String>>()