From d79273089fd57581b001e6e11701a738e60d3c24 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Fri, 17 Oct 2025 02:49:55 +0200 Subject: [PATCH] lint: update clippy annotations Some annotations are no longer needed with more recent clippy (1.85+), so let's remove them. Closes #11964 --- build.rs | 1 - crates/printf/src/fmt_fp/mod.rs | 1 - src/ast.rs | 2 -- src/builtins/fish_indent.rs | 1 - src/env_dispatch.rs | 3 --- src/reader.rs | 19 +++++++++---------- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/build.rs b/build.rs index 394cb74e3..9640b1c7c 100644 --- a/build.rs +++ b/build.rs @@ -132,7 +132,6 @@ fn detect_bsd(_: &Target) -> bool { if !target.chars().all(|c| c.is_ascii_lowercase()) { target = target.to_ascii_lowercase(); } - #[allow(clippy::let_and_return)] // for old clippy let is_bsd = target.ends_with("bsd") || target.ends_with("dragonfly"); #[cfg(any( target_os = "dragonfly", diff --git a/crates/printf/src/fmt_fp/mod.rs b/crates/printf/src/fmt_fp/mod.rs index 85ce171d8..d1efa9172 100644 --- a/crates/printf/src/fmt_fp/mod.rs +++ b/crates/printf/src/fmt_fp/mod.rs @@ -279,7 +279,6 @@ fn format_a(mut y: f64, params: FormatParams<'_, impl Write>) -> Result bool { } // Same base pointer and same vtable => same object. - #[allow(renamed_and_removed_lints)] - #[allow(clippy::vtable_address_comparisons)] // for old clippy if std::ptr::eq(lhs, rhs) { return true; } diff --git a/src/builtins/fish_indent.rs b/src/builtins/fish_indent.rs index c9d807882..12d482252 100644 --- a/src/builtins/fish_indent.rs +++ b/src/builtins/fish_indent.rs @@ -357,7 +357,6 @@ fn compute_multi_line_brace_statement_locations(&self) -> Vec { { next_newline += 1; } - #[allow(clippy::nonminimal_bool)] // for old clippy; false positive? let contains_newline = next_newline != newline_offsets.len() && { let newline_offset = newline_offsets[next_newline]; assert!(newline_offset >= brace_statement.source_range().start()); diff --git a/src/env_dispatch.rs b/src/env_dispatch.rs index 8d3cd41dc..4c282bf2a 100644 --- a/src/env_dispatch.rs +++ b/src/env_dispatch.rs @@ -175,8 +175,6 @@ pub fn guess_emoji_width(vars: &EnvStack) { .map(|v| v.as_string()) .unwrap_or_else(WString::new); - #[allow(renamed_and_removed_lints)] // for old clippy - #[allow(clippy::blocks_in_if_conditions)] // for old clippy if xtversion().unwrap_or(L!("")).starts_with(L!("iTerm2 ")) { // iTerm2 now defaults to Unicode 9 sizes for anything after macOS 10.12 FISH_EMOJI_WIDTH.store(2, Ordering::Relaxed); @@ -610,7 +608,6 @@ pub fn use_posix_spawn() -> bool { } /// Whether or not we are running on an OS where we allow ourselves to use `posix_spawn()`. -#[allow(clippy::needless_bool)] // for old clippy const fn allow_use_posix_spawn() -> bool { // OpenBSD's posix_spawn returns status 127 instead of erroring with ENOEXEC when faced with a // shebang-less script. Disable posix_spawn on OpenBSD. diff --git a/src/reader.rs b/src/reader.rs index 3817a7cdb..dcd7766f6 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2709,16 +2709,13 @@ fn send_xtgettcap_query(out: &mut impl Output, cap: &'static str) { out.write_command(QueryXtgettcap(cap)); } -#[allow(renamed_and_removed_lints)] -#[allow(clippy::blocks_in_if_conditions)] // for old clippy fn query_capabilities_via_dcs(out: &mut impl Output, vars: &dyn Environment) { - if { - vars.get_unless_empty(L!("STY")).is_some() - || vars.get_unless_empty(L!("TERM")).is_some_and(|term| { - let term = &term.as_list()[0]; - term == "screen" || term == "screen-256color" - }) - } { + if vars.get_unless_empty(L!("STY")).is_some() + || vars.get_unless_empty(L!("TERM")).is_some_and(|term| { + let term = &term.as_list()[0]; + term == "screen" || term == "screen-256color" + }) + { return; } out.write_command(DecsetAlternateScreenBuffer); // enable alternative screen buffer @@ -6358,12 +6355,14 @@ pub fn completion_apply_to_command_line( let (tok, _) = parse_util_token_extent(command_line, cursor_pos); maybe_add_slash(&mut trailer, &result[tok.start..new_cursor_pos]); } + // TODO(MSRV/edition 2024): use if let chain for quote instead of `is_some` followed + // by unwrap if trailer != '/' && quote.is_some() && unescaped_quote(command_line, insertion_point) != quote { // This is a quoted parameter, first print a quote. - #[allow(clippy::unnecessary_unwrap)] // for old clippy + #[allow(clippy::unnecessary_unwrap)] result.insert(new_cursor_pos, quote.unwrap()); new_cursor_pos += 1; }