diff --git a/Cargo.toml b/Cargo.toml index f23b96b..65dabe9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,12 +113,14 @@ unwrap_used = "deny" wildcard_enum_match_arm = "deny" ## Warn absolute_paths = "warn" +allow_attributes = "warn" arithmetic_side_effects = "warn" as_underscore = "warn" decimal_literal_representation = "warn" default_numeric_fallback = "warn" deref_by_slicing = "warn" empty_drop = "warn" +field_scoped_visibility_modifiers = "warn" filetype_is_file = "warn" if_then_some_else_none = "warn" indexing_slicing = "warn" diff --git a/crates/rubedo-macros/src/lib.rs b/crates/rubedo-macros/src/lib.rs index 6c64453..114c089 100644 --- a/crates/rubedo-macros/src/lib.rs +++ b/crates/rubedo-macros/src/lib.rs @@ -9,9 +9,9 @@ // Global configuration // Customisations of the standard linting configuration -#![allow(clippy::expect_used)] // Okay in a proc macro -#![allow(clippy::items_after_test_module)] // Not needed with separated tests -#![allow(clippy::panic)] // Okay in a proc macro +#![allow(clippy::expect_used, reason = "Okay in a proc macro")] +#![allow(clippy::items_after_test_module, reason = "Not needed with separated tests")] +#![allow(clippy::panic, reason = "Also okay in a proc macro")] diff --git a/crates/rubedo-macros/tests/lib.rs b/crates/rubedo-macros/tests/lib.rs index cba8f07..8450bbd 100644 --- a/crates/rubedo-macros/tests/lib.rs +++ b/crates/rubedo-macros/tests/lib.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![allow(unused_crate_dependencies, reason = "Creates a lot of noise")] // Lints specifically disabled for integration tests #![cfg_attr(test, allow( @@ -21,6 +21,7 @@ clippy::tests_outside_test_module, clippy::unwrap_in_result, clippy::unwrap_used, + reason = "Not useful in integration tests" ))] diff --git a/crates/rubedo/Cargo.toml b/crates/rubedo/Cargo.toml index 49321b7..96abe04 100644 --- a/crates/rubedo/Cargo.toml +++ b/crates/rubedo/Cargo.toml @@ -12,9 +12,6 @@ readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[features] -reasons = [] - #==============================[ DEPENDENCIES ]=============================== [dependencies] diff --git a/crates/rubedo/src/chrono.rs b/crates/rubedo/src/chrono.rs index cbd1220..b61030c 100644 --- a/crates/rubedo/src/chrono.rs +++ b/crates/rubedo/src/chrono.rs @@ -77,28 +77,23 @@ pub trait DurationExt { /// The [`Duration`] struct stores its value as a number of seconds and /// nanoseconds, but artificially limits the number of seconds so that the /// milliseconds will never overflow. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_SECONDS: i64 = i64::MAX / 1_000; /// The maximum number of minutes that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_MINUTES: i64 = i64::MAX / 1_000 / 60; /// The maximum number of hours that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_HOURS: i64 = i64::MAX / 1_000 / 60 / 60; /// The maximum number of days that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_DAYS: i64 = i64::MAX / 1_000 / 60 / 60 / 24; /// The maximum number of weeks that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_WEEKS: i64 = i64::MAX / 1_000 / 60 / 60 / 24 / 7; /// The minimum number of nanoseconds that can be represented by a @@ -160,28 +155,23 @@ pub trait DurationExt { /// The [`Duration`] struct stores its value as a number of seconds and /// nanoseconds, but artificially limits the number of seconds so that the /// milliseconds will never overflow. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MIN_SECONDS: i64 = i64::MIN / 1_000; /// The minimum number of minutes that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MIN_MINUTES: i64 = i64::MIN / 1_000 / 60; /// The minimum number of hours that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MIN_HOURS: i64 = i64::MIN / 1_000 / 60 / 60; /// The minimum number of days that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MIN_DAYS: i64 = i64::MIN / 1_000 / 60 / 60 / 24; /// The minimum number of weeks that can be represented by a [`Duration`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MIN_WEEKS: i64 = i64::MIN / 1_000 / 60 / 60 / 24 / 7; /// The units used by [`humanize()`](DurationExt::humanize()). These @@ -290,14 +280,8 @@ impl DurationExt for Duration { let seconds = self.num_seconds(); for &(unit, name) in &Self::UNITS { if seconds >= unit { - #[cfg_attr( feature = "reasons", allow(clippy::arithmetic_side_effects, - reason = "Precision is not needed here, and unit cannot be zero" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::arithmetic_side_effects))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, - reason = "Precision is not needed here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] + #[expect(clippy::arithmetic_side_effects, reason = "Precision is not needed here, and unit cannot be zero")] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] let count = seconds / unit; return format!("{} {}{}", count, name, if count == 1 { "" } else { "s" }); } @@ -310,8 +294,7 @@ impl DurationExt for Duration { if !(Self::MIN_NANOSECONDS_FULL..=Self::MAX_NANOSECONDS_FULL).contains(&nanoseconds) { return None; } - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_truncation, reason = "Range is controlled"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_truncation))] + #[expect(clippy::cast_possible_truncation, reason = "Range is controlled")] if (i128::from(Self::MIN_NANOSECONDS)..=i128::from(Self::MAX_NANOSECONDS)).contains(&nanoseconds) { Some(Self::nanoseconds(nanoseconds as i64)) } else if nanoseconds < 0 { @@ -330,8 +313,7 @@ impl DurationExt for Duration { if !(Self::MIN_MICROSECONDS_FULL..=Self::MAX_MICROSECONDS_FULL).contains(µseconds) { return None; } - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_truncation, reason = "Range is controlled"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_truncation))] + #[expect(clippy::cast_possible_truncation, reason = "Range is controlled")] if (i128::from(Self::MIN_MICROSECONDS)..=i128::from(Self::MAX_MICROSECONDS)).contains(µseconds) { Some(Self::microseconds(microseconds as i64)) } else if microseconds < 0 { @@ -369,8 +351,7 @@ pub trait MonthsExt { const MAX_MONTHS: u32 = u32::MAX; /// The maximum number of years that can be represented by a [`Months`]. - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] const MAX_YEARS: u32 = u32::MAX / 12; // months @@ -438,8 +419,7 @@ impl MonthsExt for Months { } // num_years - #[cfg_attr( feature = "reasons", allow(clippy::integer_division, reason = "Precision is not needed here"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::integer_division))] + #[expect(clippy::integer_division, reason = "Precision is not needed here")] fn num_years(&self) -> u32 { self.as_u32() / 12 } @@ -689,8 +669,7 @@ impl NaiveDateExt for NaiveDate { // days_in_month fn days_in_month(&self) -> u32 { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::days_in_month_opt(self.year(), self.month()).unwrap() } @@ -701,8 +680,7 @@ impl NaiveDateExt for NaiveDate { // days_in_year fn days_in_year(&self) -> u32 { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::days_in_year_opt(self.year()).unwrap() } @@ -713,8 +691,7 @@ impl NaiveDateExt for NaiveDate { // is_leap_year fn is_leap_year(&self) -> bool { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::is_leap_year_opt(self.year()).unwrap() } @@ -725,8 +702,7 @@ impl NaiveDateExt for NaiveDate { // start_of_month fn start_of_month(&self) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::start_of_month_opt(self.year(), self.month()).unwrap() } @@ -737,8 +713,7 @@ impl NaiveDateExt for NaiveDate { // end_of_month fn end_of_month(&self) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::end_of_month_opt(self.year(), self.month()).unwrap() } @@ -748,8 +723,7 @@ impl NaiveDateExt for NaiveDate { // The range of years is controlled by having already validated the date // by attempting to create it above. This is well within the range of a u32. // The same applies to the month. - #[cfg_attr( feature = "reasons", allow(clippy::arithmetic_side_effects, reason = "Range is controlled"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::arithmetic_side_effects))] + #[expect(clippy::arithmetic_side_effects, reason = "Range is controlled")] Self::from_ymd_opt( if month == 12 { year + 1 } else { year }, if month == 12 { month } else { month + 1 }, @@ -759,8 +733,7 @@ impl NaiveDateExt for NaiveDate { // start_of_year fn start_of_year(&self) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::start_of_year_opt(self.year()).unwrap() } @@ -771,8 +744,7 @@ impl NaiveDateExt for NaiveDate { // end_of_year fn end_of_year(&self) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::end_of_year_opt(self.year()).unwrap() } diff --git a/crates/rubedo/src/crypto.rs b/crates/rubedo/src/crypto.rs index 46fda50..59d0897 100644 --- a/crates/rubedo/src/crypto.rs +++ b/crates/rubedo/src/crypto.rs @@ -326,8 +326,7 @@ impl ForceFrom<&[u8]> for $t { fn force_from(b: &[u8]) -> Self { let mut array = [0_u8; $s]; let len = b.len().min($s); - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] array[..len].copy_from_slice(&b[..len]); Self::from(array) } @@ -995,10 +994,7 @@ impl ByteSized<32> for VerifyingKey { /// [`VerifyingKey::from_bytes()`](RealVerifyingKey::from_bytes()) instead. /// fn from_bytes(bytes: [u8; 32]) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::option_if_let_else, - reason = "Using map_or_else() here would not be as clear, and no more concise" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::option_if_let_else))] + #[expect(clippy::option_if_let_else, reason = "Using map_or_else() here would not be as clear, and no more concise")] match RealVerifyingKey::from_bytes(&bytes) { Ok(key) => Self { key }, Err(_) => Self::default(), @@ -1054,8 +1050,7 @@ impl Debug for VerifyingKey { impl Default for VerifyingKey { // default fn default() -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self { key: RealVerifyingKey::from_bytes(&[0; 32]).unwrap() } } } @@ -1455,8 +1450,7 @@ impl ForceFrom<&[u8]> for RealSigningKey { fn force_from(value: &[u8]) -> Self { let mut array = [0_u8; 32]; let len = value.len().min(32); - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] array[..len].copy_from_slice(&value[..len]); Self::from(array) } @@ -1553,8 +1547,7 @@ impl ByteSized<32> for RealVerifyingKey { /// (which will be default unless this method is specifically called). /// fn from_bytes(bytes: [u8; 32]) -> Self { - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::from_bytes(&bytes).unwrap_or_else(|_| Self::from_bytes(&[0_u8; 32]).unwrap()) } @@ -1604,11 +1597,9 @@ impl ForceFrom<&[u8]> for RealVerifyingKey { fn force_from(value: &[u8]) -> Self { let mut array = [0_u8; 32]; let len = value.len().min(32); - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] array[..len].copy_from_slice(&value[..len]); - #[cfg_attr( feature = "reasons", allow(clippy::unwrap_used, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::unwrap_used))] + #[expect(clippy::unwrap_used, reason = "Infallible")] Self::from_bytes(&array).unwrap_or_else(|_| Self::from_bytes(&[0_u8; 32]).unwrap()) } } diff --git a/crates/rubedo/src/http.rs b/crates/rubedo/src/http.rs index 7e64f17..afe1f49 100644 --- a/crates/rubedo/src/http.rs +++ b/crates/rubedo/src/http.rs @@ -21,6 +21,7 @@ use base64::{DecodeError, engine::{Engine as _, general_purpose::STANDARD as BAS use core::{ cmp::Ordering, convert::Infallible, + error::Error, fmt::{Debug, Display, Write, self}, ops::{Add, AddAssign}, str::FromStr, @@ -35,10 +36,7 @@ use hyper::{ }; use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as DeError}; use serde_json::Value as Json; -use std::{ - borrow::Cow, - error::Error, -}; +use std::borrow::Cow; @@ -56,8 +54,7 @@ use std::{ /// This enum is exhaustive and will never have any additional variants added /// to it, as all possibilities are already covered. /// -#[cfg_attr( feature = "reasons", allow(clippy::exhaustive_enums, reason = "Exhaustive"))] -#[cfg_attr(not(feature = "reasons"), allow(clippy::exhaustive_enums))] +#[expect(clippy::exhaustive_enums, reason = "Exhaustive")] #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] pub enum ContentType { /// The response body is text. It will be represented as an ordinary @@ -83,8 +80,7 @@ pub enum ResponseError { impl Display for ResponseError { // fmt fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - #[cfg_attr( feature = "reasons", allow(clippy::pattern_type_mismatch, reason = "Cannot dereference a Box"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::pattern_type_mismatch))] + #[expect(clippy::pattern_type_mismatch, reason = "Cannot dereference a Box")] let description = match self { Self::ConversionError(err) => format!("Error encountered while converting response body to bytes: {err}"), }; @@ -211,7 +207,7 @@ impl UnpackedResponse { /// * `body` - The response body. See [`body`](UnpackedResponse::body). /// #[must_use] - pub fn new_from_parts( + pub const fn new_from_parts( status: StatusCode, headers: Vec, body: UnpackedResponseBody @@ -246,8 +242,7 @@ impl PartialEq for UnpackedResponse { /// /// * [`UnpackedResponse`] /// -#[cfg_attr( feature = "reasons", allow(clippy::exhaustive_structs, reason = "Exhaustive"))] -#[cfg_attr(not(feature = "reasons"), allow(clippy::exhaustive_structs))] +#[expect(clippy::exhaustive_structs, reason = "Exhaustive")] #[derive(Debug, Deserialize, Serialize)] pub struct UnpackedResponseHeader { // Public properties @@ -740,8 +735,7 @@ impl UnpackedResponseBody { pub fn push_char(&mut self, char: &char) { let mut bytes = [0; 4]; let used = char.encode_utf8(&mut bytes).len(); - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] self.body.extend(&bytes[..used]); } @@ -1193,8 +1187,7 @@ impl From for UnpackedResponseBody { fn from(c: char) -> Self { let mut bytes = [0; 4]; let used = c.encode_utf8(&mut bytes).len(); - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] Self { body: bytes[..used].to_vec(), ..Default::default() } } } @@ -1417,10 +1410,7 @@ impl <'de> Deserialize<'de> for UnpackedResponseBody { D: Deserializer<'de>, { let string = String::deserialize(deserializer)?; - #[cfg_attr( feature = "reasons", allow(clippy::option_if_let_else, - reason = "Using map_or_else() here would not be as clear, and no more concise" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::option_if_let_else))] + #[expect(clippy::option_if_let_else, reason = "Using map_or_else() here would not be as clear, and no more concise")] match BASE64.decode(&string) { Ok(decoded) => Ok(Self { body: decoded, content_type: ContentType::Binary }), Err(_) => Ok(Self { body: string.into_bytes(), content_type: ContentType::Text }), @@ -1552,8 +1542,7 @@ impl ResponseExt for Response { /// fn convert_headers(headermap: &HeaderMap) -> Vec { let mut headers = vec![]; - #[cfg_attr( feature = "reasons", allow(clippy::shadow_reuse, reason = "Clear purpose"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::shadow_reuse))] + #[expect(clippy::shadow_reuse, reason = "Clear purpose")] for (name, value) in headermap { let name = name.as_str().to_owned(); let value = String::from_utf8_lossy(value.as_bytes()).into_owned(); @@ -1624,8 +1613,7 @@ fn convert_response( /// * [`http::StatusCode`] /// * [`UnpackedResponse`] /// -#[cfg_attr( feature = "reasons", allow(clippy::trivially_copy_pass_by_ref, reason = "Needs to match trait"))] -#[cfg_attr(not(feature = "reasons"), allow(clippy::trivially_copy_pass_by_ref))] +#[expect(clippy::trivially_copy_pass_by_ref, reason = "Needs to match trait")] fn serialize_status_code(status_code: &StatusCode, serializer: S) -> Result where S: Serializer, diff --git a/crates/rubedo/src/lib.rs b/crates/rubedo/src/lib.rs index 222ba62..adc2ab3 100644 --- a/crates/rubedo/src/lib.rs +++ b/crates/rubedo/src/lib.rs @@ -9,13 +9,9 @@ // Global configuration -#![cfg_attr(feature = "reasons", feature(lint_reasons))] - // Customisations of the standard linting configuration -#![cfg_attr( feature = "reasons", allow(clippy::multiple_crate_versions, reason = "Cannot resolve all these"))] -#![cfg_attr(not(feature = "reasons"), allow(clippy::multiple_crate_versions))] -#![cfg_attr( feature = "reasons", allow(clippy::items_after_test_module, reason = "Not needed with separated tests"))] -#![cfg_attr(not(feature = "reasons"), allow(clippy::items_after_test_module))] +#![allow(clippy::multiple_crate_versions, reason = "Cannot resolve all these")] +#![allow(clippy::items_after_test_module, reason = "Not needed with separated tests")] // Lints specifically disabled for unit tests #![cfg_attr(test, allow( @@ -37,6 +33,7 @@ clippy::print_stdout, clippy::unwrap_in_result, clippy::unwrap_used, + reason = "Not useful in unit tests" ))] diff --git a/crates/rubedo/src/std.rs b/crates/rubedo/src/std.rs index 0ad1316..7f300ca 100644 --- a/crates/rubedo/src/std.rs +++ b/crates/rubedo/src/std.rs @@ -1,7 +1,6 @@ -#![cfg_attr( feature = "reasons", allow(clippy::std_instead_of_core, +#![allow(clippy::std_instead_of_core, reason = "False positive due to bug: https://github.com/rust-lang/rust-clippy/issues/12438" -))] -#![cfg_attr(not(feature = "reasons"), allow(clippy::std_instead_of_core))] +)] //! This module provides extensions to the Rust standard library. @@ -121,8 +120,7 @@ impl Iterator for LimitIterator { // next fn next(&mut self) -> Option { - #[cfg_attr( feature = "reasons", allow(clippy::arithmetic_side_effects, reason = "Range is controlled"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::arithmetic_side_effects))] + #[expect(clippy::arithmetic_side_effects, reason = "Range is controlled")] if let Some(limit) = self.limit { if self.count >= limit { return None; @@ -235,8 +233,7 @@ impl AsStr for str { /// * [`ByteSizedFull`] /// * [`ByteSizedMut`] /// -#[cfg_attr( feature = "reasons", allow(clippy::trait_duplication_in_bounds, reason = "Not actually duplicates"))] -#[cfg_attr(not(feature = "reasons"), allow(clippy::trait_duplication_in_bounds))] +#[expect(clippy::trait_duplication_in_bounds, reason = "Not actually duplicates")] pub trait ByteSized: Sized + Clone @@ -473,8 +470,7 @@ pub trait ByteSized: /// * [`ByteSized`] /// * [`ByteSizedMut`] /// -#[cfg_attr( feature = "reasons", allow(clippy::trait_duplication_in_bounds, reason = "Not actually duplicates"))] -#[cfg_attr(not(feature = "reasons"), allow(clippy::trait_duplication_in_bounds))] +#[expect(clippy::trait_duplication_in_bounds, reason = "Not actually duplicates")] pub trait ByteSizedFull: ByteSized + AsRef<[u8; SIZE]> @@ -653,8 +649,7 @@ impl FileExt for File { if count == 0 { break; } - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] hasher.update(&buffer[..count]); } Ok(T::from_digest(hasher.finalize())) @@ -696,8 +691,7 @@ impl AsyncFileExt for AsyncFile { if count == 0 { break; } - #[cfg_attr( feature = "reasons", allow(clippy::indexing_slicing, reason = "Infallible"))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::indexing_slicing))] + #[expect(clippy::indexing_slicing, reason = "Infallible")] hasher.update(&buffer[..count]); } Ok(T::from_digest(hasher.finalize())) @@ -773,35 +767,18 @@ macro_rules! impl_from_int_with_scale_for_float { //󰭅 Integer for f32 impl FromIntWithScale<$t> for f32 { // from_int_with_scale - #[cfg_attr( feature = "reasons", allow(clippy::cast_lossless, - reason = "Being potentially lossy does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_lossless))] + #[allow(clippy::allow_attributes, reason = "Multiple possibilities through the macro invocation")] + #[allow(clippy::cast_lossless, reason = "Being potentially lossy does not matter here")] fn from_int_with_scale(value: $t, scale: u8) -> Option { let factor = 10_u32.checked_pow(u32::from(scale))?; - #[cfg_attr( feature = "reasons", allow(clippy::cast_precision_loss, - reason = "Losing precision does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_precision_loss))] + #[allow(clippy::cast_precision_loss, reason = "Losing precision does not matter here")] let scaled = value as f32 / factor as f32; // We need to manually check if the value exceeds the range of integer // values supported by an f32, as that will result in a loss of precision. - #[cfg_attr( feature = "reasons", allow(trivial_numeric_casts, - reason = "Trivial casts here are due to the macro permutations" - ))] - #[cfg_attr(not(feature = "reasons"), allow(trivial_numeric_casts))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_sign_loss, - reason = "Loss of sign does not matter here, as we are checking for overflow" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_sign_loss))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_wrap, - reason = "Possible wrapping does not matter here, as we are checking for underflow" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_wrap))] - #[cfg_attr( feature = "reasons", allow(clippy::invalid_upcast_comparisons, - reason = "Superfluous upcast comparisons here are due to the macro permutations" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::invalid_upcast_comparisons))] + #[allow(trivial_numeric_casts, reason = "Trivial casts here are due to the macro permutations")] + #[allow(clippy::cast_sign_loss, reason = "Loss of sign does not matter here, as we are checking for overflow")] + #[allow(clippy::cast_possible_wrap, reason = "Possible wrapping does not matter here, as we are checking for underflow")] + #[allow(clippy::invalid_upcast_comparisons, reason = "Superfluous upcast comparisons here are due to the macro permutations")] if scaled.is_infinite() || (value as u128) > 0x0100_0000_u128 || (value as i128) < -0x0100_0000_i128 { None } else { @@ -814,35 +791,18 @@ macro_rules! impl_from_int_with_scale_for_float { //󰭅 Integer for f64 impl FromIntWithScale<$t> for f64 { // from_int_with_scale - #[cfg_attr( feature = "reasons", allow(clippy::cast_lossless, - reason = "Being potentially lossy does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_lossless))] + #[allow(clippy::allow_attributes, reason = "Multiple possibilities through the macro invocation")] + #[allow(clippy::cast_lossless, reason = "Being potentially lossy does not matter here")] fn from_int_with_scale(value: $t, scale: u8) -> Option { let factor = 10_u64.checked_pow(u32::from(scale))?; - #[cfg_attr( feature = "reasons", allow(clippy::cast_precision_loss, - reason = "Losing precision does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_precision_loss))] + #[allow(clippy::cast_precision_loss, reason = "Losing precision does not matter here")] let scaled = value as f64 / factor as f64; // We need to manually check if the value exceeds the range of integer // values supported by an f64, as that will result in a loss of precision. - #[cfg_attr( feature = "reasons", allow(trivial_numeric_casts, - reason = "Trivial casts here are due to the macro permutations" - ))] - #[cfg_attr(not(feature = "reasons"), allow(trivial_numeric_casts))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_sign_loss, - reason = "Loss of sign does not matter here, as we are checking for overflow" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_sign_loss))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_wrap, - reason = "Possible wrapping does not matter here, as we are checking for underflow" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_wrap))] - #[cfg_attr( feature = "reasons", allow(clippy::invalid_upcast_comparisons, - reason = "Superfluous upcast comparisons here are due to the macro permutations" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::invalid_upcast_comparisons))] + #[allow(trivial_numeric_casts, reason = "Trivial casts here are due to the macro permutations")] + #[allow(clippy::cast_sign_loss, reason = "Loss of sign does not matter here, as we are checking for overflow")] + #[allow(clippy::cast_possible_wrap, reason = "Possible wrapping does not matter here, as we are checking for underflow")] + #[allow(clippy::invalid_upcast_comparisons, reason = "Superfluous upcast comparisons here are due to the macro permutations")] if scaled.is_infinite() || (value as u128) > 0x0020_0000_0000_0000_u128 || (value as i128) < -0x0020_0000_0000_0000_i128 { None } else { @@ -897,20 +857,15 @@ macro_rules! impl_from_int_with_scale_for_decimal { //󰭅 u128 for Decimal impl FromIntWithScale for Decimal { // from_int_with_scale - #[cfg_attr( feature = "reasons", allow(clippy::cast_lossless, - reason = "Being potentially lossy does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_lossless))] + #[allow(clippy::allow_attributes, reason = "Multiple possibilities through the macro invocation")] + #[allow(clippy::cast_lossless, reason = "Being potentially lossy does not matter here")] fn from_int_with_scale(value: u128, scale: u8) -> Option { // We should be able to rely upon Decimal::try_from_i128_with_scale() to // perform the necessary checks, but it currently has issues with numbers // larger than the supported 96-bit range, so we need to check manually. // Regardless of this, we would have to check if the value is larger than // supported by an i128 in any case. - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_wrap, - reason = "Possible wrapping does not matter here, as we are checking for underflow" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_wrap))] + #[allow(clippy::cast_possible_wrap, reason = "Possible wrapping does not matter here, as we are checking for underflow")] if value > Decimal::MAX.to_u128().unwrap() || (value as i128) < Decimal::MIN.to_i128().unwrap() { None } else { @@ -923,10 +878,8 @@ macro_rules! impl_from_int_with_scale_for_decimal { //󰭅 Integer for Decimal impl FromIntWithScale<$t> for Decimal { // from_int_with_scale - #[cfg_attr( feature = "reasons", allow(clippy::cast_lossless, - reason = "Being potentially lossy does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_lossless))] + #[allow(clippy::allow_attributes, reason = "Multiple possibilities through the macro invocation")] + #[allow(clippy::cast_lossless, reason = "Being potentially lossy does not matter here")] fn from_int_with_scale(value: $t, scale: u8) -> Option { // Everything less than 128 bits will fit safely into the Decimal's range. Decimal::try_from_i128_with_scale(value as i128, u32::from(scale)).ok() @@ -1012,28 +965,17 @@ macro_rules! impl_to_int_with_scale_for_float { //󰭅 Integer for Float impl ToIntWithScale<$t> for $f { // to_int_with_scale - #[cfg_attr( feature = "reasons", allow(clippy::cast_lossless, - reason = "Being potentially lossy does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_lossless))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_precision_loss, - reason = "Losing precision does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_precision_loss))] + #[allow(clippy::allow_attributes, reason = "Multiple possibilities through the macro invocation")] + #[allow(clippy::cast_lossless, reason = "Being potentially lossy does not matter here")] + #[allow(clippy::cast_precision_loss, reason = "Losing precision does not matter here")] fn to_int_with_scale(&self, scale: u8) -> Option<$t> { let factor = 10_u64.checked_pow(u32::from(scale))?; let scaled = (self * factor as $f).round(); if scaled.is_infinite() || scaled > <$t>::MAX as $f || scaled < <$t>::MIN as $f { None } else { - #[cfg_attr( feature = "reasons", allow(clippy::cast_possible_truncation, - reason = "Possible truncation does not matter here" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_possible_truncation))] - #[cfg_attr( feature = "reasons", allow(clippy::cast_sign_loss, - reason = "Loss of sign will not occur here, as we are casting to a float" - ))] - #[cfg_attr(not(feature = "reasons"), allow(clippy::cast_sign_loss))] + #[allow(clippy::cast_possible_truncation, reason = "Possible truncation does not matter here")] + #[allow(clippy::cast_sign_loss, reason = "Loss of sign will not occur here, as we are casting to a float")] Some(scaled as $t) } } diff --git a/crates/rubedo/src/tests/chrono.rs b/crates/rubedo/src/tests/chrono.rs index e9896c0..4734402 100644 --- a/crates/rubedo/src/tests/chrono.rs +++ b/crates/rubedo/src/tests/chrono.rs @@ -467,7 +467,7 @@ mod months_ext { } // num_years - #[allow(clippy::integer_division)] + #[expect(clippy::integer_division, reason = "Acceptable for the test")] #[test] fn num_years() { assert_eq!(Months::new(0).num_years(), 0); @@ -486,7 +486,7 @@ mod naivedate_ext { use super::*; // MAX_YEAR - #[allow(clippy::decimal_literal_representation)] + #[expect(clippy::decimal_literal_representation, reason = "Needed for clear formatting")] #[test] fn max_year__max_allowed() { assert_eq!(Utc.with_ymd_and_hms(NaiveDate::MAX_YEAR, 12, 31, 00, 00, 00).unwrap(), Utc.with_ymd_and_hms(262_142, 12, 31, 00, 00, 00).unwrap()); @@ -498,7 +498,7 @@ mod naivedate_ext { } // MIN_YEAR - #[allow(clippy::decimal_literal_representation)] + #[expect(clippy::decimal_literal_representation, reason = "Needed for clear formatting")] #[test] fn min_year__min_allowed() { assert_eq!(Utc.with_ymd_and_hms(NaiveDate::MIN_YEAR, 1, 1, 00, 00, 00).unwrap(), Utc.with_ymd_and_hms(-262_143, 1, 1, 00, 00, 00).unwrap()); diff --git a/crates/rubedo/src/tests/crypto.rs b/crates/rubedo/src/tests/crypto.rs index 79ce2a2..34922e0 100644 --- a/crates/rubedo/src/tests/crypto.rs +++ b/crates/rubedo/src/tests/crypto.rs @@ -54,7 +54,7 @@ mod sha256_hash__struct { use super::*; // new - #[allow(clippy::needless_borrows_for_generic_args)] + #[expect(clippy::needless_borrows_for_generic_args, reason = "Needed for the test")] #[test] fn new() { let hash1 = Sha256Hash::new(TEST_256_HASH); @@ -261,7 +261,7 @@ mod sha256_hash__traits { } // clone - #[allow(clippy::clone_on_copy)] + #[expect(clippy::clone_on_copy, reason = "Needed for the test")] #[test] fn clone() { let mut hash = Sha256Hash { hash: TEST_256_HASH }; @@ -498,7 +498,7 @@ mod sha512_hash__struct { use super::*; // new - #[allow(clippy::needless_borrows_for_generic_args)] + #[expect(clippy::needless_borrows_for_generic_args, reason = "Needed for the test")] #[test] fn new() { let hash1 = Sha512Hash::new(TEST_512_HASH); @@ -705,7 +705,7 @@ mod sha512_hash__traits { } // clone - #[allow(clippy::clone_on_copy)] + #[expect(clippy::clone_on_copy, reason = "Needed for the test")] #[test] fn clone() { let mut hash = Sha512Hash { hash: TEST_512_HASH }; @@ -1096,7 +1096,7 @@ mod signing_key__traits { } // clone - #[allow(clippy::redundant_clone)] + #[expect(clippy::redundant_clone, reason = "Needed for the test")] #[test] fn clone() { let key = SigningKey { key: RealSigningKey::from_bytes(&TEST_PRVKEY) }; @@ -1129,7 +1129,7 @@ mod signing_key__traits { } // deref - #[allow(clippy::explicit_deref_methods)] + #[expect(clippy::explicit_deref_methods, reason = "Needed for the test")] #[test] fn deref() { let key = SigningKey { key: RealSigningKey::from_bytes(&TEST_PRVKEY) }; @@ -1607,7 +1607,7 @@ mod verifying_key__traits { } // clone - #[allow(clippy::clone_on_copy)] + #[expect(clippy::clone_on_copy, reason = "Needed for the test")] #[test] fn clone() { let key = VerifyingKey { key: RealVerifyingKey::from_bytes(&TEST_PUBKEY).unwrap() }; @@ -1640,7 +1640,7 @@ mod verifying_key__traits { } // deref - #[allow(clippy::explicit_deref_methods)] + #[expect(clippy::explicit_deref_methods, reason = "Needed for the test")] #[test] fn deref() { let key = VerifyingKey { key: RealVerifyingKey::from_bytes(&TEST_PUBKEY).unwrap() }; diff --git a/crates/rubedo/src/tests/http.rs b/crates/rubedo/src/tests/http.rs index b6bc149..a42e4cf 100644 --- a/crates/rubedo/src/tests/http.rs +++ b/crates/rubedo/src/tests/http.rs @@ -460,7 +460,7 @@ mod unpacked_response_body__struct { } // to_base64 - #[allow(invalid_from_utf8)] + #[expect(invalid_from_utf8, reason = "Needed for the test")] #[test] fn to_base64() { let mut body = UnpackedResponseBody { @@ -478,7 +478,7 @@ mod unpacked_response_body__struct { } // from_base64 - #[allow(invalid_from_utf8)] + #[expect(invalid_from_utf8, reason = "Needed for the test")] #[test] fn from_base64__valid() { let body1 = UnpackedResponseBody::from_base64("VGhpcyBpcyBhIHRlc3Q=").unwrap(); @@ -594,7 +594,7 @@ mod unpacked_response_body__traits { // Uncommenting the line below would cause a compilation error: //assert_eq!(body, UnpackedResponseBody { body: b"This is".to_vec(), ..Default::default() }); } - #[allow(clippy::string_lit_as_bytes)] + #[expect(clippy::string_lit_as_bytes, reason = "Needed for the test")] #[test] fn add__char_one_byte() { let body = UnpackedResponseBody { body: b"This is ".to_vec(), ..Default::default() }; @@ -631,7 +631,7 @@ mod unpacked_response_body__traits { // Uncommenting the line below would cause a compilation error: //assert_eq!(body, UnpackedResponseBody { body: s!("This is ").into_bytes() }); } - #[allow(clippy::string_lit_as_bytes)] + #[expect(clippy::string_lit_as_bytes, reason = "Needed for the test")] #[test] fn add__char_ref() { let body = UnpackedResponseBody { body: b"This is ".to_vec(), ..Default::default() }; @@ -771,7 +771,7 @@ mod unpacked_response_body__traits { body += &b" a test"[..]; assert_eq!(body, UnpackedResponseBody { body: b"This is a test".to_vec(), ..Default::default() }); } - #[allow(clippy::string_lit_as_bytes)] + #[expect(clippy::string_lit_as_bytes, reason = "Needed for the test")] #[test] fn add_assign__char_one_byte() { let mut body = UnpackedResponseBody { body: b"This is ".to_vec(), ..Default::default() }; @@ -796,7 +796,7 @@ mod unpacked_response_body__traits { body += '𐍈'; assert_eq!(body, UnpackedResponseBody { body: s!("This is 𐍈").into_bytes(), ..Default::default() }); } - #[allow(clippy::string_lit_as_bytes)] + #[expect(clippy::string_lit_as_bytes, reason = "Needed for the test")] #[test] fn add_assign__char_ref() { let mut body = UnpackedResponseBody { body: b"This is ".to_vec(), ..Default::default() }; @@ -1016,7 +1016,7 @@ mod unpacked_response_body__traits { assert_eq!(body, UnpackedResponseBody { body: b"A".to_vec(), ..Default::default() }); assert_eq!(char, 'A'); } - #[allow(clippy::string_lit_as_bytes)] + #[expect(clippy::string_lit_as_bytes, reason = "Needed for the test")] #[test] fn from__char_one_byte() { let body = UnpackedResponseBody::from('A'); diff --git a/crates/rubedo/src/tests/serde.rs b/crates/rubedo/src/tests/serde.rs index fae2337..35e1826 100644 --- a/crates/rubedo/src/tests/serde.rs +++ b/crates/rubedo/src/tests/serde.rs @@ -500,13 +500,13 @@ fn from_str__int() { let test: IntFromStr = serde_json::from_str(r#"{"foo":"1234"}"#).unwrap(); assert_eq!(test.foo, 1234); } -#[allow(clippy::float_cmp)] +#[expect(clippy::float_cmp, reason = "Acceptable for the test")] #[test] fn from_str__float() { let test: FloatFromStr = serde_json::from_str(r#"{"foo":"12.34"}"#).unwrap(); assert_eq!(test.foo, 12.34); } -#[allow(clippy::bool_assert_comparison)] +#[expect(clippy::bool_assert_comparison, reason = "Consistency with the other tests")] #[test] fn from_str__bool() { let test: BoolFromStr = serde_json::from_str(r#"{"foo":"true"}"#).unwrap(); @@ -641,7 +641,7 @@ fn try_from__string_absent() { } // try_from_int_1dp__f32_u8 -#[allow(clippy::float_cmp)] +#[expect(clippy::float_cmp, reason = "Acceptable for the test")] #[test] fn try_from_int_1dp__f32_u8() { let test: F32TryFromInt1DpU8 = serde_json::from_str(r#"{"foo":123}"#).unwrap(); @@ -649,7 +649,7 @@ fn try_from_int_1dp__f32_u8() { } // try_from_int_2dp__f64_u16 -#[allow(clippy::float_cmp)] +#[expect(clippy::float_cmp, reason = "Acceptable for the test")] #[test] fn try_from_int_2dp__f64_u16() { let test: F64TryFromInt2DpU16 = serde_json::from_str(r#"{"foo":1234}"#).unwrap(); @@ -664,7 +664,7 @@ fn try_from_int_3dp__Decimal_u32() { } // try_from_int_4dp__f32_u64 -#[allow(clippy::float_cmp)] +#[expect(clippy::float_cmp, reason = "Acceptable for the test")] #[test] fn try_from_int_4dp__f32_u64() { let test: F32TryFromInt4DpU64 = serde_json::from_str(r#"{"foo":12345}"#).unwrap(); diff --git a/crates/rubedo/src/tests/std.rs b/crates/rubedo/src/tests/std.rs index 63876ad..0bc1bc2 100644 --- a/crates/rubedo/src/tests/std.rs +++ b/crates/rubedo/src/tests/std.rs @@ -472,7 +472,7 @@ mod iterator_ext { use super::*; // limit - #[allow(clippy::needless_collect)] + #[expect(clippy::needless_collect, reason = "Consistency with the other tests")] #[test] fn limit__empty() { let vec: Vec = Vec::new(); @@ -508,7 +508,7 @@ mod path_ext { use super::*; // append - #[allow(clippy::unnecessary_to_owned)] + #[expect(clippy::unnecessary_to_owned, reason = "Needed for the test")] #[test] fn append() { let mut path: PathBuf; @@ -631,8 +631,8 @@ mod path_ext { } // restrict - #[allow(clippy::needless_borrows_for_generic_args)] - #[allow(clippy::unnecessary_to_owned)] + #[expect(clippy::needless_borrows_for_generic_args, reason = "Needed for the test")] + #[expect(clippy::unnecessary_to_owned, reason = "Also needed for the test")] #[test] fn restrict() { let cwd = env::current_dir().unwrap(); diff --git a/crates/rubedo/src/tests/sugar.rs b/crates/rubedo/src/tests/sugar.rs index 84e8f59..f69f93f 100644 --- a/crates/rubedo/src/tests/sugar.rs +++ b/crates/rubedo/src/tests/sugar.rs @@ -66,10 +66,7 @@ mod variants { // variants! #[test] - #[cfg_attr( feature = "reasons", allow(trivial_casts, - reason = "Trivial cast here is needed for the test" - ))] - #[cfg_attr(not(feature = "reasons"), allow(trivial_casts))] + #[expect(trivial_casts, reason = "Trivial cast here is needed for the test")] fn variants__empty() { assert_eq!(variants![] as Vec, vec![]); assert_eq!(variants!() as Vec, vec![]); @@ -111,10 +108,7 @@ mod variants_hashset { // variants_hashset! #[test] - #[cfg_attr( feature = "reasons", allow(trivial_casts, - reason = "Trivial cast here is needed for the test" - ))] - #[cfg_attr(not(feature = "reasons"), allow(trivial_casts))] + #[expect(trivial_casts, reason = "Trivial cast here is needed for the test")] fn variants__empty() { assert_eq!(variants_hashset![] as HashSet, HashSet::new()); assert_eq!(variants_hashset!() as HashSet, HashSet::new()); diff --git a/crates/rubedo/tests/chrono.rs b/crates/rubedo/tests/chrono.rs index 1adb4c7..26e41ec 100644 --- a/crates/rubedo/tests/chrono.rs +++ b/crates/rubedo/tests/chrono.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![allow(unused_crate_dependencies, reason = "Creates a lot of noise")] // Lints specifically disabled for integration tests #![cfg_attr(test, allow( @@ -21,6 +21,7 @@ clippy::tests_outside_test_module, clippy::unwrap_in_result, clippy::unwrap_used, + reason = "Not useful in integration tests" ))] diff --git a/crates/rubedo/tests/crypto.rs b/crates/rubedo/tests/crypto.rs index 8d0cf99..9f96181 100644 --- a/crates/rubedo/tests/crypto.rs +++ b/crates/rubedo/tests/crypto.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![allow(unused_crate_dependencies, reason = "Creates a lot of noise")] // Lints specifically disabled for integration tests #![cfg_attr(test, allow( @@ -21,6 +21,7 @@ clippy::tests_outside_test_module, clippy::unwrap_in_result, clippy::unwrap_used, + reason = "Not useful in integration tests" ))] diff --git a/crates/rubedo/tests/serde.rs b/crates/rubedo/tests/serde.rs index cf49e77..fef2bcf 100644 --- a/crates/rubedo/tests/serde.rs +++ b/crates/rubedo/tests/serde.rs @@ -1,4 +1,4 @@ -#![allow(unused_crate_dependencies)] +#![allow(unused_crate_dependencies, reason = "Creates a lot of noise")] // Lints specifically disabled for integration tests #![cfg_attr(test, allow( @@ -21,6 +21,7 @@ clippy::tests_outside_test_module, clippy::unwrap_in_result, clippy::unwrap_used, + reason = "Not useful in integration tests" ))]