From 5853fbe4bb423adc3400e1413d4b0a26c3a19f10 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Wed, 28 May 2025 13:46:06 +0200 Subject: [PATCH] ref: Disallow using `#[allow]` `#[expect]` should be used instead. --- src/api/mod.rs | 3 --- src/config.rs | 2 +- src/main.rs | 1 + src/utils/auth_token/org_auth_token.rs | 2 +- src/utils/dif_upload/mod.rs | 2 +- src/utils/logging.rs | 8 ++++---- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/api/mod.rs b/src/api/mod.rs index 3dce2fbd2a..89ce9ce10f 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1553,7 +1553,6 @@ fn handle_req( } /// Iterator over response headers -#[allow(dead_code)] pub struct Headers<'a> { lines: &'a [String], idx: usize, @@ -1857,7 +1856,6 @@ impl ApiResponse { } /// Iterates over the headers. - #[allow(dead_code)] pub fn headers(&self) -> Headers<'_> { Headers { lines: &self.headers[..], @@ -1866,7 +1864,6 @@ impl ApiResponse { } /// Looks up the first matching header for a key. - #[allow(dead_code)] pub fn get_header(&self, key: &str) -> Option<&str> { for (header_key, header_value) in self.headers() { if header_key.eq_ignore_ascii_case(key) { diff --git a/src/config.rs b/src/config.rs index 289a2e8d92..af1e0d5824 100644 --- a/src/config.rs +++ b/src/config.rs @@ -723,7 +723,7 @@ impl Clone for Config { } } -#[allow(clippy::manual_map)] +#[expect(clippy::manual_map)] fn get_default_auth(ini: &Ini) -> Option { if let Ok(val) = env::var("SENTRY_AUTH_TOKEN") { Some(Auth::Token(val.into())) diff --git a/src/main.rs b/src/main.rs index 0ac5e46067..12a5bf079d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![warn(clippy::allow_attributes)] #![warn(clippy::unnecessary_wraps)] mod api; diff --git a/src/utils/auth_token/org_auth_token.rs b/src/utils/auth_token/org_auth_token.rs index e7a325d2e5..3790f99d43 100644 --- a/src/utils/auth_token/org_auth_token.rs +++ b/src/utils/auth_token/org_auth_token.rs @@ -13,7 +13,7 @@ pub struct OrgAuthToken { /// Represents the payload data of an org auth token. #[derive(Clone, Debug, Deserialize)] -#[allow(dead_code)] // Otherwise, we get a warning about unused fields +#[expect(dead_code)] // Otherwise, we get a warning about unused fields pub struct AuthTokenPayload { iat: f64, pub region_url: String, diff --git a/src/utils/dif_upload/mod.rs b/src/utils/dif_upload/mod.rs index ac475196a7..574383acaf 100644 --- a/src/utils/dif_upload/mod.rs +++ b/src/utils/dif_upload/mod.rs @@ -864,7 +864,7 @@ fn collect_object_dif<'a>( // We retain the buffer and the borrowed object in a new SelfCell. This is // incredibly unsafe, but in our case it is fine, since the SelfCell owns the same // buffer that was used to retrieve the object. - #[allow(clippy::missing_transmute_annotations)] + #[expect(clippy::missing_transmute_annotations)] let cell = unsafe { SelfCell::from_raw( buffer.clone(), diff --git a/src/utils/logging.rs b/src/utils/logging.rs index f79aab13e3..00293b632a 100644 --- a/src/utils/logging.rs +++ b/src/utils/logging.rs @@ -24,7 +24,7 @@ pub fn set_quiet_mode(is_quiet: bool) { } // NOTE: Remove `allow`s after first use. -#[allow(unused_macros)] +#[expect(unused_macros)] macro_rules! quiet_println { ($($tt:tt)*) => {{ if !crate::utils::logging::is_quiet_mode() { @@ -32,11 +32,11 @@ macro_rules! quiet_println { } }}; } -#[allow(unused_imports)] +#[expect(unused_imports)] pub(crate) use quiet_println; // NOTE: Remove `allow`s after first use. -#[allow(unused_macros)] +#[expect(unused_macros)] macro_rules! quiet_eprintln { ($($tt:tt)*) => {{ if !crate::utils::logging::is_quiet_mode() { @@ -44,7 +44,7 @@ macro_rules! quiet_eprintln { } }}; } -#[allow(unused_imports)] +#[expect(unused_imports)] pub(crate) use quiet_eprintln; // Globally shared ProgressBar instance.