Skip to content

Commit

Permalink
bevy_tasks: Apply `#[deny(clippy::allow_attributes, clippy::allow_att…
Browse files Browse the repository at this point in the history
…ributes_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.
  • Loading branch information
LikeLakers2 authored Jan 2, 2025
1 parent 22bf3b9 commit 5a5ddb9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/bevy_tasks/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion crates/bevy_tasks/src/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ where
}

#[cfg(test)]
#[allow(clippy::disallowed_types)]
mod tests {
use super::*;
use core::sync::atomic::{AtomicBool, AtomicI32, Ordering};
Expand Down

0 comments on commit 5a5ddb9

Please sign in to comment.