Skip to content

Commit

Permalink
Move `#![warn(clippy::allow_attributes, clippy::allow_attributes_with…
Browse files Browse the repository at this point in the history
…out_reason)]` to the workspace `Cargo.toml` (#17374)

# Objective
Fixes #17111

## Solution
Move `#![warn(clippy::allow_attributes,
clippy::allow_attributes_without_reason)]` to the workspace `Cargo.toml`

## Testing
Lots of CI testing, and local testing too.

---------

Co-authored-by: Benjamin Brienen <[email protected]>
  • Loading branch information
LikeLakers2 and BenjaminBrienen authored Jan 15, 2025
1 parent 0756a19 commit 26bb0b4
Show file tree
Hide file tree
Showing 55 changed files with 73 additions and 221 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ std_instead_of_core = "warn"
std_instead_of_alloc = "warn"
alloc_instead_of_core = "warn"

allow_attributes = "warn"
allow_attributes_without_reason = "warn"

[workspace.lints.rust]
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
Expand Down Expand Up @@ -95,6 +98,9 @@ std_instead_of_core = "allow"
std_instead_of_alloc = "allow"
alloc_instead_of_core = "allow"

allow_attributes = "warn"
allow_attributes_without_reason = "warn"

[lints.rust]
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
Expand Down
3 changes: 3 additions & 0 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ ref_as_ptr = "warn"
# see: https://github.com/bevyengine/bevy/pull/15375#issuecomment-2366966219
too_long_first_doc_paragraph = "allow"

allow_attributes = "warn"
allow_attributes_without_reason = "warn"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
unsafe_op_in_unsafe_fn = "warn"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![allow(dead_code)]
#![expect(
dead_code,
reason = "The `Mat4`s in the structs are used to bloat the size of the structs for benchmarking purposes."
)]

use bevy_ecs::prelude::*;
use glam::*;
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_a11y/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![forbid(unsafe_code)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
)]
#![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@
//! This trait mirrors [`AssetLoader`] in structure, and works in tandem with [`AssetWriter`](io::AssetWriter), which mirrors [`AssetReader`](io::AssetReader).
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_audio/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![forbid(unsafe_code)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_color/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_core_pipeline/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![forbid(unsafe_code)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_dev_tools/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_diagnostic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_dylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(
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"
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_ecs/examples/change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
//! To demonstrate change detection, there are some console outputs based on changes in
//! the `EntityCounter` resource and updated Age components
#![expect(clippy::std_instead_of_core)]
#![expect(
clippy::std_instead_of_core,
reason = "Examples should not follow this lint"
)]

use bevy_ecs::prelude::*;
use rand::Rng;
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_ecs/examples/resources.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! In this example we add a counter resource and increase its value in one system,
//! while a different system prints the current count to the console.
#![expect(clippy::std_instead_of_core)]
#![expect(
clippy::std_instead_of_core,
reason = "Examples should not follow this lint"
)]

use bevy_ecs::prelude::*;
use rand::Rng;
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
)]
#![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))]
#![expect(unsafe_code, reason = "Unsafe code is used to improve performance.")]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_gilrs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_gltf/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_hierarchy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_image/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]

extern crate alloc;

Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_input/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_input_focus/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_internal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_macro_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![forbid(unsafe_code)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_math/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![forbid(unsafe_code)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(
any(docsrs, docsrs_dep),
expect(
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_mesh/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]

extern crate alloc;
extern crate core;
Expand Down
5 changes: 5 additions & 0 deletions crates/bevy_mikktspace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#![allow(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "Much of the code here is still code that's been transpiled from C; we want to save 'fixing' this crate until after it's ported to safe rust."
)]
#![allow(
unsafe_op_in_unsafe_fn,
clippy::all,
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![forbid(unsafe_code)]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_picking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@
//! the plugin with arbitrary backends and input methods, yet still use all the high level features.
#![deny(missing_docs)]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]

extern crate alloc;

Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_ptr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![expect(unsafe_code, reason = "Raw pointers are inherently unsafe.")]
#![warn(
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"
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(
any(docsrs, docsrs_dep),
expect(
Expand Down
6 changes: 0 additions & 6 deletions crates/bevy_remote/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,6 @@
//! [fully-qualified type names]: bevy_reflect::TypePath::type_path
//! [fully-qualified type name]: bevy_reflect::TypePath::type_path
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]

use async_channel::{Receiver, Sender};
use bevy_app::{prelude::*, MainScheduleOrder};
use bevy_derive::{Deref, DerefMut};
Expand Down
5 changes: 0 additions & 5 deletions crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
#![expect(unsafe_code, reason = "Unsafe code is used to improve performance.")]
#![warn(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "See #17111; To be removed once all crates are in-line with these attributes"
)]
#![cfg_attr(
any(docsrs, docsrs_dep),
expect(
Expand Down
Loading

0 comments on commit 26bb0b4

Please sign in to comment.