mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 12:11:16 -03:00
lint: update clippy annotations
Some annotations are no longer needed with more recent clippy (1.85+), so let's remove them. Closes #11964
This commit is contained in:
committed by
Johannes Altmanninger
parent
68d02916e2
commit
d79273089f
1
build.rs
1
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",
|
||||
|
||||
@@ -279,7 +279,6 @@ fn format_a(mut y: f64, params: FormatParams<'_, impl Write>) -> Result<usize, E
|
||||
|
||||
// Compute the number of hex digits in the mantissa after the decimal.
|
||||
// -1 for leading 1 bit (we are to the range [1, 2)), then divide by 4, rounding up.
|
||||
#[allow(unknown_lints)] // for old clippy
|
||||
#[allow(clippy::manual_div_ceil)]
|
||||
const MANTISSA_HEX_DIGITS: usize = (MANTISSA_BITS - 1 + 3) / 4;
|
||||
if had_prec && prec < MANTISSA_HEX_DIGITS {
|
||||
|
||||
@@ -251,8 +251,6 @@ pub fn is_same_node(lhs: &dyn Node, rhs: &dyn Node) -> 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;
|
||||
}
|
||||
|
||||
@@ -357,7 +357,6 @@ fn compute_multi_line_brace_statement_locations(&self) -> Vec<usize> {
|
||||
{
|
||||
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());
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user