From 910437a4fdd506701b5bccc0bebf8b47df521ef4 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Wed, 1 Jan 2025 21:19:51 -0500 Subject: [PATCH 1/3] Apply `#[deny(clippy::allow_attributes)]` and `#[deny(clippy::allow_attributes_without_reason)]` to `bevy_color` --- crates/bevy_color/src/lib.rs | 13 ++++++++++++- crates/bevy_color/src/oklaba.rs | 10 ++++++++-- crates/bevy_color/src/palettes/css.rs | 1 - 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index 4a4a9596d545d..de9d5f2f7d060 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -1,5 +1,9 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] +#![deny( + clippy::allow_attributes, + clippy::allow_attributes_without_reason +)] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", html_favicon_url = "https://bevyengine.org/assets/icon.png" @@ -142,7 +146,14 @@ pub use srgba::*; pub use xyza::*; /// Describes the traits that a color should implement for consistency. -#[allow(dead_code)] // This is an internal marker trait used to ensure that our color types impl the required traits +#[expect( + clippy::allow_attributes, + reason = "If the below attribute on `dead_code` is removed, then rustc complains that `StandardColor` is dead code. However, if we `expect` the `dead_code` lint, then rustc complains of an unfulfilled expectation." +)] +#[allow( + dead_code, + reason = "This is an internal marker trait used to ensure that our color types impl the required traits" +)] pub(crate) trait StandardColor where Self: core::fmt::Debug, diff --git a/crates/bevy_color/src/oklaba.rs b/crates/bevy_color/src/oklaba.rs index 0ffb35ddd33db..551bd1f5f7d1c 100644 --- a/crates/bevy_color/src/oklaba.rs +++ b/crates/bevy_color/src/oklaba.rs @@ -216,7 +216,10 @@ impl ColorToComponents for Oklaba { } } -#[allow(clippy::excessive_precision)] +#[expect( + clippy::excessive_precision, + reason = "The code with excessive precision was copied from another codebase." +)] impl From for Oklaba { fn from(value: LinearRgba) -> Self { let LinearRgba { @@ -239,7 +242,10 @@ impl From for Oklaba { } } -#[allow(clippy::excessive_precision)] +#[expect( + clippy::excessive_precision, + reason = "The code with excessive precision was copied from another codebase." +)] impl From for LinearRgba { fn from(value: Oklaba) -> Self { let Oklaba { diff --git a/crates/bevy_color/src/palettes/css.rs b/crates/bevy_color/src/palettes/css.rs index 0c1e073bec4b6..9b0dd7fe7e18f 100644 --- a/crates/bevy_color/src/palettes/css.rs +++ b/crates/bevy_color/src/palettes/css.rs @@ -4,7 +4,6 @@ use crate::Srgba; // The CSS4 colors are a superset of the CSS1 colors, so we can just re-export the CSS1 colors. -#[allow(unused_imports)] pub use crate::palettes::basic::*; ///
From 13745b666eec72b4a0ca1d11c69e0d8bd79b9c21 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Thu, 2 Jan 2025 02:45:44 -0500 Subject: [PATCH 2/3] Please the almighty `rustfmt` --- crates/bevy_color/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index de9d5f2f7d060..f4de64a4f4f6a 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -1,9 +1,6 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] -#![deny( - clippy::allow_attributes, - clippy::allow_attributes_without_reason -)] +#![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", html_favicon_url = "https://bevyengine.org/assets/icon.png" From df74dee3ae1e158a8e36030a96a2dafb6a288a4a Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Fri, 3 Jan 2025 04:59:31 -0500 Subject: [PATCH 3/3] Update the deny to link to the tracking issue --- crates/bevy_color/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index f4de64a4f4f6a..488f14fdaf7fa 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -1,6 +1,10 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] -#![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] +#![deny( + clippy::allow_attributes, + clippy::allow_attributes_without_reason, + reason = "See #17111; To be removed once all crates are in-line with these attributes" +)] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", html_favicon_url = "https://bevyengine.org/assets/icon.png"