From c0649ad4bb161c7235c6a05805271c5bc08cadb8 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 14 Sep 2024 06:49:13 -0700 Subject: [PATCH] remove cfg_attr(feature = "cargo-clippy" noise I never liked clippy for dropping turds like this throughout the code. I'm glad it is no longer required, but now rust is warning about this syntax being redundant. --- codec/src/lib.rs | 2 +- config/src/font.rs | 2 +- pty/src/unix.rs | 4 ++-- term/src/input.rs | 5 +---- term/src/screen.rs | 2 +- term/src/terminalstate/mod.rs | 2 +- termwiz/src/color.rs | 2 +- termwiz/src/escape/mod.rs | 2 +- termwiz/src/escape/osc.rs | 5 +---- termwiz/src/image.rs | 2 +- termwiz/src/render/terminfo.rs | 7 ++----- termwiz/src/widgets/mod.rs | 2 +- wezterm-gui/src/selection.rs | 2 +- wezterm-gui/src/termwindow/mod.rs | 2 +- 14 files changed, 16 insertions(+), 25 deletions(-) diff --git a/codec/src/lib.rs b/codec/src/lib.rs index 1f200d877..717672288 100644 --- a/codec/src/lib.rs +++ b/codec/src/lib.rs @@ -9,7 +9,7 @@ //! of this code; in this way the client and server can more gracefully //! manage unknown enum variants. #![allow(dead_code)] -#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] +#![allow(clippy::range_plus_one)] use anyhow::{bail, Context as _, Error}; use config::keyassignment::{PaneDirection, ScrollbackEraseMode}; diff --git a/config/src/font.rs b/config/src/font.rs index f137a792d..99b75fcb8 100644 --- a/config/src/font.rs +++ b/config/src/font.rs @@ -581,7 +581,7 @@ impl TextStyle { } } - #[cfg_attr(feature = "cargo-clippy", allow(clippy::let_and_return))] + #[allow(clippy::let_and_return)] pub fn font_with_fallback(&self) -> Vec { let mut font = self.font.clone(); diff --git a/pty/src/unix.rs b/pty/src/unix.rs index 2fd7207a7..cc458ce97 100644 --- a/pty/src/unix.rs +++ b/pty/src/unix.rs @@ -32,7 +32,7 @@ fn openpty(size: PtySize) -> anyhow::Result<(UnixMasterPty, UnixSlavePty)> { let result = unsafe { // BSDish systems may require mut pointers to some args - #[cfg_attr(feature = "cargo-clippy", allow(clippy::unnecessary_mut_passed))] + #[allow(clippy::unnecessary_mut_passed)] libc::openpty( &mut master, &mut slave, @@ -262,7 +262,7 @@ impl PtyFd { // type::from(), but the size and potentially signedness // are system dependent, which is why we're using `as _`. // Suppress this lint for this section of code. - #[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))] + #[allow(clippy::cast_lossless)] if controlling_tty { // Set the pty as the controlling terminal. // Failure to do this means that delivery of diff --git a/term/src/input.rs b/term/src/input.rs index cc2031fda..748461b0c 100644 --- a/term/src/input.rs +++ b/term/src/input.rs @@ -1,8 +1,5 @@ // clippy hates bitflags -#![cfg_attr( - feature = "cargo-clippy", - allow(clippy::suspicious_arithmetic_impl, clippy::redundant_field_names) -)] +#![allow(clippy::suspicious_arithmetic_impl, clippy::redundant_field_names)] use super::VisibleRowIndex; #[cfg(feature = "use_serde")] diff --git a/term/src/screen.rs b/term/src/screen.rs index dc1f383f6..10a06077a 100644 --- a/term/src/screen.rs +++ b/term/src/screen.rs @@ -1,4 +1,4 @@ -#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] +#![allow(clippy::range_plus_one)] use super::*; use crate::config::BidiMode; use log::debug; diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index ddbd8772a..c9a2d80ee 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1,6 +1,6 @@ // The range_plus_one lint can't see when the LHS is not compatible with // and inclusive range -#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] +#![allow(clippy::range_plus_one)] use super::*; use crate::color::{ColorPalette, RgbColor}; use crate::config::{BidiMode, NewlineCanon}; diff --git a/termwiz/src/color.rs b/termwiz/src/color.rs index 51dbb0afd..f8f5e2c5f 100644 --- a/termwiz/src/color.rs +++ b/termwiz/src/color.rs @@ -1,6 +1,6 @@ //! Colors for attributes // for FromPrimitive -#![cfg_attr(feature = "cargo-clippy", allow(clippy::useless_attribute))] +#![allow(clippy::useless_attribute)] use num_derive::*; #[cfg(feature = "use_serde")] diff --git a/termwiz/src/escape/mod.rs b/termwiz/src/escape/mod.rs index b5d359e0b..474237879 100644 --- a/termwiz/src/escape/mod.rs +++ b/termwiz/src/escape/mod.rs @@ -1,6 +1,6 @@ // suppress inscrutable useless_attribute clippy that shows up when // using derive(FromPrimitive) -#![cfg_attr(feature = "cargo-clippy", allow(clippy::useless_attribute))] +#![allow(clippy::useless_attribute)] #![allow(clippy::upper_case_acronyms)] //! This module provides the ability to parse escape sequences and attach //! semantic meaning to them. It can also encode the semantic values as diff --git a/termwiz/src/escape/osc.rs b/termwiz/src/escape/osc.rs index 564fa75de..d69b1beb8 100644 --- a/termwiz/src/escape/osc.rs +++ b/termwiz/src/escape/osc.rs @@ -1085,10 +1085,7 @@ impl ITermDimension { } impl ITermProprietary { - #[cfg_attr( - feature = "cargo-clippy", - allow(clippy::cyclomatic_complexity, clippy::cognitive_complexity) - )] + #[allow(clippy::cyclomatic_complexity, clippy::cognitive_complexity)] fn parse(osc: &[&[u8]]) -> Result { // iTerm has a number of different styles of OSC parameter // encodings, which makes this section of code a bit gnarly. diff --git a/termwiz/src/image.rs b/termwiz/src/image.rs index 7f7bfbe71..e7f9ca7c0 100644 --- a/termwiz/src/image.rs +++ b/termwiz/src/image.rs @@ -30,7 +30,7 @@ where } #[cfg(feature = "use_serde")] -#[cfg_attr(feature = "cargo-clippy", allow(clippy::trivially_copy_pass_by_ref))] +#[allow(clippy::trivially_copy_pass_by_ref)] fn serialize_notnan(value: &NotNan, serializer: S) -> Result where S: Serializer, diff --git a/termwiz/src/render/terminfo.rs b/termwiz/src/render/terminfo.rs index 7b52b1bc6..41746fb2b 100644 --- a/termwiz/src/render/terminfo.rs +++ b/termwiz/src/render/terminfo.rs @@ -48,7 +48,7 @@ impl TerminfoRenderer { }); } - #[cfg_attr(feature = "cargo-clippy", allow(clippy::cognitive_complexity))] + #[allow(clippy::cognitive_complexity)] fn flush_pending_attr(&mut self, out: &mut W) -> Result<()> { macro_rules! attr_on { ($cap:ident, $sgr:expr) => {{ @@ -330,10 +330,7 @@ impl TerminfoRenderer { Ok(()) } - #[cfg_attr( - feature = "cargo-clippy", - allow(clippy::cyclomatic_complexity, clippy::cognitive_complexity) - )] + #[allow(clippy::cyclomatic_complexity, clippy::cognitive_complexity)] pub fn render_to( &mut self, changes: &[Change], diff --git a/termwiz/src/widgets/mod.rs b/termwiz/src/widgets/mod.rs index fe91dcd19..9f232429e 100644 --- a/termwiz/src/widgets/mod.rs +++ b/termwiz/src/widgets/mod.rs @@ -400,7 +400,7 @@ impl<'widget> Ui<'widget> { let mut changed = false; // Clippy is dead wrong about this iterator being an identity_conversion - #[cfg_attr(feature = "cargo-clippy", allow(clippy::identity_conversion))] + #[allow(clippy::identity_conversion)] for result in layout.compute_constraints(width, height, root)? { let render_data = self.render.get_mut(&result.widget).unwrap(); let coords = ParentRelativeCoords::new(result.rect.x, result.rect.y); diff --git a/wezterm-gui/src/selection.rs b/wezterm-gui/src/selection.rs index 6797b9698..53b2d62b3 100644 --- a/wezterm-gui/src/selection.rs +++ b/wezterm-gui/src/selection.rs @@ -1,6 +1,6 @@ // The range_plus_one lint can't see when the LHS is not compatible with // and inclusive range -#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] +#![allow(clippy::range_plus_one)] use mux::pane::Pane; use std::cmp::Ordering; use std::ops::Range; diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 2fd543b5f..9792074fd 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -1,4 +1,4 @@ -#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))] +#![allow(clippy::range_plus_one)] use super::renderstate::*; use super::utilsprites::RenderMetrics; use crate::colorease::ColorEase;