From 5a5ddb9e35655520d4fa13572535e5053274bbf3 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Thu, 2 Jan 2025 17:42:25 -0500 Subject: [PATCH] bevy_tasks: Apply `#[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]` (#17089) # Objective We want to deny the following lints: * `clippy::allow_attributes` - Because there's no reason to `#[allow(...)]` an attribute if it wouldn't lint against anything; you should always use `#[expect(...)]` * `clippy::allow_attributes_without_reason` - Because documenting the reason for allowing/expecting a lint is always good ## Solution Set the `clippy::allow_attributes` and `clippy::allow_attributes_without_reason` lints to `deny`, and bring `bevy_tasks` in line with the new restrictions. No code changes have been made - except if a lint that was previously `allow(...)`'d could be removed via small code changes. For example, `unused_variables` can be handled by adding a `_` to the beginning of a field's name. ## Testing I ran `cargo clippy`, and received no errors. --- crates/bevy_tasks/src/executor.rs | 2 ++ crates/bevy_tasks/src/lib.rs | 1 + crates/bevy_tasks/src/task_pool.rs | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_tasks/src/executor.rs b/crates/bevy_tasks/src/executor.rs index e545daf84d734..3c18ccd897fa1 100644 --- a/crates/bevy_tasks/src/executor.rs +++ b/crates/bevy_tasks/src/executor.rs @@ -50,6 +50,7 @@ pub struct LocalExecutor<'a>(LocalExecutorInner<'a>); impl Executor<'_> { /// Construct a new [`Executor`] + #[expect(clippy::allow_attributes, reason = "This lint may not always trigger.")] #[allow(dead_code, reason = "not all feature flags require this function")] pub const fn new() -> Self { Self(ExecutorInner::new()) @@ -58,6 +59,7 @@ impl Executor<'_> { impl LocalExecutor<'_> { /// Construct a new [`LocalExecutor`] + #[expect(clippy::allow_attributes, reason = "This lint may not always trigger.")] #[allow(dead_code, reason = "not all feature flags require this function")] pub const fn new() -> Self { Self(LocalExecutorInner::new()) diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index 1be5761bd0f86..97b13b0052b93 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -5,6 +5,7 @@ html_favicon_url = "https://bevyengine.org/assets/icon.png" )] #![cfg_attr(not(feature = "std"), no_std)] +#![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] extern crate alloc; diff --git a/crates/bevy_tasks/src/task_pool.rs b/crates/bevy_tasks/src/task_pool.rs index 215981215f2f7..94f59bbce99ac 100644 --- a/crates/bevy_tasks/src/task_pool.rs +++ b/crates/bevy_tasks/src/task_pool.rs @@ -694,7 +694,6 @@ where } #[cfg(test)] -#[allow(clippy::disallowed_types)] mod tests { use super::*; use core::sync::atomic::{AtomicBool, AtomicI32, Ordering};