From cd4a9f4e74d243d44bdaebde5d4188cdc100951a Mon Sep 17 00:00:00 2001 From: Justin Su Date: Tue, 15 Jul 2025 08:09:05 -0400 Subject: Fix clippy errors (#2016) --- src/handlers/grep.rs | 2 +- src/subcommands/external.rs | 2 +- src/utils/bat/output.rs | 2 +- src/utils/tabs.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs index 69e7957..8dc69b7 100644 --- a/src/handlers/grep.rs +++ b/src/handlers/grep.rs @@ -404,7 +404,7 @@ fn get_code_style_sections<'b>( if let Some(prefix_end) = ansi::ansi_preserving_index( raw_line, match line_number { - Some(n) => format!("{}:{}:", path, n).len() - 1, + Some(n) => format!("{path}:{n}:").len() - 1, None => path.len(), }, ) { diff --git a/src/subcommands/external.rs b/src/subcommands/external.rs index dc98a20..0ab56dc 100644 --- a/src/subcommands/external.rs +++ b/src/subcommands/external.rs @@ -37,7 +37,7 @@ impl std::fmt::Debug for SubCmdKind { SubCmdKind::Git(Some(arg)) => { return formatter.write_fmt(format_args!("\"git {}\"", arg.escape_debug())) } - _ => format!("{}", self), + _ => format!("{self}"), }; formatter.write_str("\"")?; formatter.write_str(&s)?; diff --git a/src/utils/bat/output.rs b/src/utils/bat/output.rs index 4b5baa4..76a35d5 100644 --- a/src/utils/bat/output.rs +++ b/src/utils/bat/output.rs @@ -73,7 +73,7 @@ impl OutputType { ) .unwrap(); let mut writer = output_type.handle().unwrap(); - write!(&mut writer, "{}", data) + write!(&mut writer, "{data}") } pub fn from_mode( diff --git a/src/utils/tabs.rs b/src/utils/tabs.rs index 67eab32..47ec0ef 100644 --- a/src/utils/tabs.rs +++ b/src/utils/tabs.rs @@ -21,7 +21,7 @@ impl TabCfg { /// Expand tabs as spaces. pub fn expand(line: &str, tab_cfg: &TabCfg) -> String { - if tab_cfg.replace() && line.as_bytes().iter().any(|c| *c == b'\t') { + if tab_cfg.replace() && line.as_bytes().contains(&b'\t') { itertools::join(line.split('\t'), &tab_cfg.replacement) } else { line.to_string() -- cgit v1.2.3