From 40a423905a62a8d30c9172e93adbe7f068265acf Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Tue, 14 Mar 2023 21:19:14 +0100 Subject: [PATCH] Fix clippy warnings with Rust 1.68 --- src/bin/bat/clap_app.rs | 2 +- src/diff.rs | 4 ++-- src/preprocessor.rs | 2 +- src/printer.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 027701cb..57cd2bcf 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -559,7 +559,7 @@ pub fn build_app(interactive_output: bool) -> Command { ) .group( ArgGroup::new("cache-actions") - .args(&["build", "clear"]) + .args(["build", "clear"]) .required(true), ) .arg( diff --git a/src/diff.rs b/src/diff.rs index 1aaca4f4..78d20c30 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -17,11 +17,11 @@ pub enum LineChange { pub type LineChanges = HashMap; pub fn get_git_diff(filename: &Path) -> Option { - let repo = Repository::discover(&filename).ok()?; + let repo = Repository::discover(filename).ok()?; let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?; - let filepath_absolute = fs::canonicalize(&filename).ok()?; + let filepath_absolute = fs::canonicalize(filename).ok()?; let filepath_relative_to_repo = filepath_absolute.strip_prefix(&repo_path_absolute).ok()?; let mut diff_options = DiffOptions::new(); diff --git a/src/preprocessor.rs b/src/preprocessor.rs index 74590355..c4e64106 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -20,7 +20,7 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String { // Add tab. let spaces = width - (*cursor % width); *cursor += spaces; - buffer.push_str(&*" ".repeat(spaces)); + buffer.push_str(&" ".repeat(spaces)); // Next. text = &text[index + 1..text.len()]; diff --git a/src/printer.rs b/src/printer.rs index 27c92b91..24384d3a 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -621,7 +621,7 @@ impl<'a> Printer for InteractivePrinter<'a> { "{}\n{}", as_terminal_escaped( style, - &*format!("{}{}", self.ansi_style, line_buf), + &format!("{}{}", self.ansi_style, line_buf), self.config.true_color, self.config.colored_output, self.config.use_italic_text, @@ -647,7 +647,7 @@ impl<'a> Printer for InteractivePrinter<'a> { "{}", as_terminal_escaped( style, - &*format!("{}{}", self.ansi_style, line_buf), + &format!("{}{}", self.ansi_style, line_buf), self.config.true_color, self.config.colored_output, self.config.use_italic_text,