From 26bb0b40d26ee93a8938986ed68a58a897a0e166 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Tue, 14 Jan 2025 20:14:58 -0500 Subject: [PATCH] Move `#![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)]` to the workspace `Cargo.toml` (#17374) # Objective Fixes https://github.com/bevyengine/bevy/issues/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 --- Cargo.toml | 6 ++++++ benches/Cargo.toml | 3 +++ .../components/add_remove_very_big_table.rs | 5 ++++- crates/bevy_a11y/src/lib.rs | 5 ----- crates/bevy_animation/src/lib.rs | 5 ----- crates/bevy_app/src/lib.rs | 5 ----- crates/bevy_asset/src/lib.rs | 5 ----- crates/bevy_audio/src/lib.rs | 5 ----- crates/bevy_color/src/lib.rs | 5 ----- crates/bevy_core_pipeline/src/lib.rs | 5 ----- crates/bevy_dev_tools/src/lib.rs | 5 ----- crates/bevy_diagnostic/src/lib.rs | 5 ----- crates/bevy_dylib/src/lib.rs | 5 ----- crates/bevy_ecs/examples/change_detection.rs | 5 ++++- crates/bevy_ecs/examples/resources.rs | 5 ++++- crates/bevy_ecs/src/lib.rs | 5 ----- crates/bevy_gilrs/src/lib.rs | 5 ----- crates/bevy_gizmos/src/lib.rs | 5 ----- crates/bevy_gltf/src/lib.rs | 5 ----- crates/bevy_hierarchy/src/lib.rs | 5 ----- crates/bevy_image/src/lib.rs | 5 ----- crates/bevy_input/src/lib.rs | 5 ----- crates/bevy_input_focus/src/lib.rs | 5 ----- crates/bevy_internal/src/lib.rs | 5 ----- crates/bevy_log/src/lib.rs | 5 ----- crates/bevy_macro_utils/src/lib.rs | 5 ----- crates/bevy_math/src/lib.rs | 5 ----- crates/bevy_mesh/src/lib.rs | 5 ----- crates/bevy_mikktspace/src/lib.rs | 5 +++++ crates/bevy_pbr/src/lib.rs | 5 ----- crates/bevy_picking/src/lib.rs | 5 ----- crates/bevy_ptr/src/lib.rs | 5 ----- crates/bevy_reflect/src/lib.rs | 5 ----- crates/bevy_remote/src/lib.rs | 6 ------ crates/bevy_render/src/lib.rs | 5 ----- crates/bevy_scene/src/lib.rs | 5 ----- crates/bevy_sprite/src/lib.rs | 5 ----- crates/bevy_state/src/lib.rs | 5 ----- crates/bevy_tasks/src/lib.rs | 5 ----- crates/bevy_text/src/lib.rs | 5 ----- crates/bevy_time/src/lib.rs | 5 ----- crates/bevy_transform/src/lib.rs | 5 ----- crates/bevy_ui/src/lib.rs | 5 ----- crates/bevy_utils/src/lib.rs | 5 ----- crates/bevy_window/src/lib.rs | 5 ----- crates/bevy_winit/src/lib.rs | 5 ----- examples/asset/custom_asset.rs | 5 ++++- examples/asset/processing/asset_processing.rs | 5 ++++- examples/ecs/dynamic.rs | 5 ++++- examples/ecs/immutable_components.rs | 5 ++++- examples/math/render_primitives.rs | 9 ++++++++- examples/reflection/reflection_types.rs | 7 ++++--- examples/stress_tests/many_components.rs | 20 +++++++++++++------ examples/stress_tests/transform_hierarchy.rs | 1 - src/lib.rs | 7 +++++-- 55 files changed, 73 insertions(+), 221 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b528e5b7d56c8..21d3dbacdd452 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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)'] } @@ -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)'] } diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 28fc57e0fe6eb..1e55f712a7a79 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -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" diff --git a/benches/benches/bevy_ecs/components/add_remove_very_big_table.rs b/benches/benches/bevy_ecs/components/add_remove_very_big_table.rs index 1a4f238cd32c2..72555be8c28b0 100644 --- a/benches/benches/bevy_ecs/components/add_remove_very_big_table.rs +++ b/benches/benches/bevy_ecs/components/add_remove_very_big_table.rs @@ -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::*; diff --git a/crates/bevy_a11y/src/lib.rs b/crates/bevy_a11y/src/lib.rs index 9a7924998701c..453ac7b7f88cd 100644 --- a/crates/bevy_a11y/src/lib.rs +++ b/crates/bevy_a11y/src/lib.rs @@ -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", diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 72b898b3e054e..f50fddd711918 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -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" diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 5523f0ceaea54..13021924d033e 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -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" diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index ec5c7905a3abe..10a1bcd8f6d4b 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -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", diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 5734d68c10abd..babae2f8a9be9 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -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", diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index dfdcb0e666a3b..e1ee1fbe38cd0 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -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" diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index b47f5513438ae..6c2ee5bec489b 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -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", diff --git a/crates/bevy_dev_tools/src/lib.rs b/crates/bevy_dev_tools/src/lib.rs index cf9eed7f75d17..0f9dc75611326 100644 --- a/crates/bevy_dev_tools/src/lib.rs +++ b/crates/bevy_dev_tools/src/lib.rs @@ -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" diff --git a/crates/bevy_diagnostic/src/lib.rs b/crates/bevy_diagnostic/src/lib.rs index e003a0093866c..970fc5ba07ae3 100644 --- a/crates/bevy_diagnostic/src/lib.rs +++ b/crates/bevy_diagnostic/src/lib.rs @@ -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" diff --git a/crates/bevy_dylib/src/lib.rs b/crates/bevy_dylib/src/lib.rs index 93528c70c9a50..1ff40ce3e8bb8 100644 --- a/crates/bevy_dylib/src/lib.rs +++ b/crates/bevy_dylib/src/lib.rs @@ -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" diff --git a/crates/bevy_ecs/examples/change_detection.rs b/crates/bevy_ecs/examples/change_detection.rs index 0efe2fa978726..23420b5e88038 100644 --- a/crates/bevy_ecs/examples/change_detection.rs +++ b/crates/bevy_ecs/examples/change_detection.rs @@ -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; diff --git a/crates/bevy_ecs/examples/resources.rs b/crates/bevy_ecs/examples/resources.rs index f5de6f7b3d30e..43eddf7ce2bf1 100644 --- a/crates/bevy_ecs/examples/resources.rs +++ b/crates/bevy_ecs/examples/resources.rs @@ -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; diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 5b2b2d7a891e6..606d1b9e9113f 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -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" diff --git a/crates/bevy_gilrs/src/lib.rs b/crates/bevy_gilrs/src/lib.rs index c9ffa983ca25b..b8d83adbf3592 100644 --- a/crates/bevy_gilrs/src/lib.rs +++ b/crates/bevy_gilrs/src/lib.rs @@ -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" diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 85ab68b649d0d..a7bca0769a352 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -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" diff --git a/crates/bevy_gltf/src/lib.rs b/crates/bevy_gltf/src/lib.rs index e0f126af550b3..b96d49c12d60c 100644 --- a/crates/bevy_gltf/src/lib.rs +++ b/crates/bevy_gltf/src/lib.rs @@ -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" diff --git a/crates/bevy_hierarchy/src/lib.rs b/crates/bevy_hierarchy/src/lib.rs index 97e930070b37b..2e8beea501f7d 100644 --- a/crates/bevy_hierarchy/src/lib.rs +++ b/crates/bevy_hierarchy/src/lib.rs @@ -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" diff --git a/crates/bevy_image/src/lib.rs b/crates/bevy_image/src/lib.rs index 9b48d7b60c4b6..55f74a5f14d35 100644 --- a/crates/bevy_image/src/lib.rs +++ b/crates/bevy_image/src/lib.rs @@ -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; diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index 11475d4fdc059..2da2c89cce8ca 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -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" diff --git a/crates/bevy_input_focus/src/lib.rs b/crates/bevy_input_focus/src/lib.rs index c7feba9786d35..2e63ad339c830 100644 --- a/crates/bevy_input_focus/src/lib.rs +++ b/crates/bevy_input_focus/src/lib.rs @@ -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" diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index a004d28d783ce..e9d25adbdf8bb 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -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" diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index cd7db4556c6fc..8328744e5b024 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -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" diff --git a/crates/bevy_macro_utils/src/lib.rs b/crates/bevy_macro_utils/src/lib.rs index 7883ee2cf299a..28de7e2227e26 100644 --- a/crates/bevy_macro_utils/src/lib.rs +++ b/crates/bevy_macro_utils/src/lib.rs @@ -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", diff --git a/crates/bevy_math/src/lib.rs b/crates/bevy_math/src/lib.rs index fef32490f3549..20d458db72d23 100644 --- a/crates/bevy_math/src/lib.rs +++ b/crates/bevy_math/src/lib.rs @@ -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( diff --git a/crates/bevy_mesh/src/lib.rs b/crates/bevy_mesh/src/lib.rs index 0baa1db8ecc10..83bc30df3518b 100644 --- a/crates/bevy_mesh/src/lib.rs +++ b/crates/bevy_mesh/src/lib.rs @@ -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; diff --git a/crates/bevy_mikktspace/src/lib.rs b/crates/bevy_mikktspace/src/lib.rs index 519e5894f0f7f..ee5f149a8ca19 100644 --- a/crates/bevy_mikktspace/src/lib.rs +++ b/crates/bevy_mikktspace/src/lib.rs @@ -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, diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 44107dfe7dd5d..3aa35561c2584 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -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" diff --git a/crates/bevy_picking/src/lib.rs b/crates/bevy_picking/src/lib.rs index 509c13d27bfed..396dcfd7939ed 100644 --- a/crates/bevy_picking/src/lib.rs +++ b/crates/bevy_picking/src/lib.rs @@ -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; diff --git a/crates/bevy_ptr/src/lib.rs b/crates/bevy_ptr/src/lib.rs index 9c8bd69144596..d767a25d4c63d 100644 --- a/crates/bevy_ptr/src/lib.rs +++ b/crates/bevy_ptr/src/lib.rs @@ -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" diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index 8082533119fd1..5604adeacd6ce 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -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( diff --git a/crates/bevy_remote/src/lib.rs b/crates/bevy_remote/src/lib.rs index 5bb33d3a36538..bbb8e18cc37ba 100644 --- a/crates/bevy_remote/src/lib.rs +++ b/crates/bevy_remote/src/lib.rs @@ -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}; diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 015bf8d4d8475..dd631832d56e3 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -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( diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index 035fcbe0dd381..76673219c5e7d 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -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" diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index cb93157069a7d..2ab05ea14679d 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -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" diff --git a/crates/bevy_state/src/lib.rs b/crates/bevy_state/src/lib.rs index 5d3537a64c020..cdcb37f4ca24d 100644 --- a/crates/bevy_state/src/lib.rs +++ b/crates/bevy_state/src/lib.rs @@ -37,11 +37,6 @@ ) )] #![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))] -#![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(feature = "std")] extern crate std; diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index 3c4f5551ad53a..220f3dcae2631 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -4,11 +4,6 @@ html_logo_url = "https://bevyengine.org/assets/icon.png", html_favicon_url = "https://bevyengine.org/assets/icon.png" )] -#![warn( - clippy::allow_attributes, - clippy::allow_attributes_without_reason, - reason = "See #17111; To be removed once all crates are in-line with these attributes" -)] #![no_std] #[cfg(feature = "std")] diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index a1902f5b114f6..7f71f486e4eb6 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -28,11 +28,6 @@ //! retrieving glyphs from the cache, or rasterizing to a [`FontAtlas`] if necessary. //! 3. [`PositionedGlyph`]s are stored in a [`TextLayoutInfo`], //! which contains all the information that downstream systems need for rendering. -#![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; diff --git a/crates/bevy_time/src/lib.rs b/crates/bevy_time/src/lib.rs index 74d42026b1123..c72e13982430e 100644 --- a/crates/bevy_time/src/lib.rs +++ b/crates/bevy_time/src/lib.rs @@ -1,11 +1,6 @@ #![doc = include_str!("../README.md")] #![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" diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 81b2388750ca1..9a6538ed53d9f 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -1,10 +1,5 @@ #![doc = include_str!("../README.md")] #![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" diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index e9e0e9c64e26b..d60e7f4febd60 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -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(docsrs, feature(doc_auto_cfg))] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index f539ffc4fd1c6..0fd3fa6a7e0f3 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -1,8 +1,3 @@ -#![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", diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 3b6822a7c285f..8ef4cb9c0c7b9 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -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" diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 123f2c123c172..c2a3eddc52f04 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -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" diff --git a/examples/asset/custom_asset.rs b/examples/asset/custom_asset.rs index b22a617404271..8d4ac958ecdd1 100644 --- a/examples/asset/custom_asset.rs +++ b/examples/asset/custom_asset.rs @@ -10,7 +10,10 @@ use thiserror::Error; #[derive(Asset, TypePath, Debug, Deserialize)] struct CustomAsset { - #[allow(dead_code)] + #[expect( + dead_code, + reason = "Used to show how the data inside an asset file will be loaded into the struct" + )] value: i32, } diff --git a/examples/asset/processing/asset_processing.rs b/examples/asset/processing/asset_processing.rs index e7eefd3aafba0..47a12fc6bb202 100644 --- a/examples/asset/processing/asset_processing.rs +++ b/examples/asset/processing/asset_processing.rs @@ -113,7 +113,10 @@ struct CoolTextRon { #[derive(Asset, TypePath, Debug)] struct CoolText { text: String, - #[allow(unused)] + #[expect( + dead_code, + reason = "Used to show that our assets can hold handles to other assets" + )] dependencies: Vec>, } diff --git a/examples/ecs/dynamic.rs b/examples/ecs/dynamic.rs index b2138be85a7f7..d5ca961f77d64 100644 --- a/examples/ecs/dynamic.rs +++ b/examples/ecs/dynamic.rs @@ -1,4 +1,7 @@ -#![allow(unsafe_code)] +#![expect( + unsafe_code, + reason = "Unsafe code is needed to work with dynamic components" +)] //! This example show how you can create components dynamically, spawn entities with those components //! as well as query for entities with those components. diff --git a/examples/ecs/immutable_components.rs b/examples/ecs/immutable_components.rs index 2e9b54522cd3d..9b385a466b01e 100644 --- a/examples/ecs/immutable_components.rs +++ b/examples/ecs/immutable_components.rs @@ -127,7 +127,10 @@ fn demo_2(world: &mut World) { } /// This example demonstrates how to work with _dynamic_ immutable components. -#[allow(unsafe_code)] +#[expect( + unsafe_code, + reason = "Unsafe code is needed to work with dynamic components" +)] fn demo_3(world: &mut World) { // This is a list of dynamic components we will create. // The first item is the name of the component, and the second is the size diff --git a/examples/math/render_primitives.rs b/examples/math/render_primitives.rs index a87caa9d8033e..4d9b3325510bf 100644 --- a/examples/math/render_primitives.rs +++ b/examples/math/render_primitives.rs @@ -1,6 +1,5 @@ //! This example demonstrates how each of Bevy's math primitives look like in 2D and 3D with meshes //! and with gizmos -#![allow(clippy::match_same_arms)] use bevy::{input::common_conditions::input_just_pressed, math::Isometry2d, prelude::*}; @@ -441,6 +440,10 @@ fn draw_gizmos_2d(mut gizmos: Gizmos, state: Res>, time let isometry = Isometry2d::new(POSITION, Rot2::radians(angle)); let color = Color::WHITE; + #[expect( + clippy::match_same_arms, + reason = "Certain primitives don't have any 2D rendering support yet." + )] match state.get() { PrimitiveSelected::RectangleAndCuboid => { gizmos.primitive_2d(&RECTANGLE, isometry, color); @@ -652,6 +655,10 @@ fn draw_gizmos_3d(mut gizmos: Gizmos, state: Res>, time let color = Color::WHITE; let resolution = 10; + #[expect( + clippy::match_same_arms, + reason = "Certain primitives don't have any 3D rendering support yet." + )] match state.get() { PrimitiveSelected::RectangleAndCuboid => { gizmos.primitive_3d(&CUBOID, isometry, color); diff --git a/examples/reflection/reflection_types.rs b/examples/reflection/reflection_types.rs index 689f012782840..6229392b32b0e 100644 --- a/examples/reflection/reflection_types.rs +++ b/examples/reflection/reflection_types.rs @@ -1,4 +1,3 @@ -#![allow(clippy::match_same_arms)] //! This example illustrates how reflection works for simple data structures, like //! structs, tuples and vectors. @@ -34,7 +33,6 @@ pub struct C(usize); /// Deriving reflect on an enum will implement the `Reflect` and `Enum` traits #[derive(Reflect)] -#[allow(dead_code)] enum D { A, B(usize), @@ -61,7 +59,6 @@ pub struct E { #[derive(Reflect, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] #[reflect(opaque)] #[reflect(PartialEq, Serialize, Deserialize)] -#[allow(dead_code)] enum F { X, Y, @@ -124,6 +121,10 @@ fn setup() { // implementation. Opaque is implemented for opaque types like String and Instant, // but also include primitive types like i32, usize, and f32 (despite not technically being opaque). ReflectRef::Opaque(_) => {} + #[expect( + clippy::allow_attributes, + reason = "`unreachable_patterns` is not always linted" + )] #[allow( unreachable_patterns, reason = "This example cannot always detect when `bevy_reflect/functions` is enabled." diff --git a/examples/stress_tests/many_components.rs b/examples/stress_tests/many_components.rs index 795116cced9c0..9729b8573c581 100644 --- a/examples/stress_tests/many_components.rs +++ b/examples/stress_tests/many_components.rs @@ -45,7 +45,10 @@ fn base_system(access_components: In>, mut query: Query() }; @@ -62,7 +65,10 @@ fn base_system(access_components: In>, mut query: Query(); @@ -82,7 +88,7 @@ fn stress_test(num_entities: u32, num_components: u32, num_systems: u32) { let component_ids: Vec = (1..=num_components) .map(|i| { world.register_component_with_descriptor( - #[allow(unsafe_code)] + #[expect(unsafe_code, reason = "Used to register a bunch of fake components")] // SAFETY: // we don't implement a drop function // u8 is Sync and Send @@ -130,7 +136,10 @@ fn stress_test(num_entities: u32, num_components: u32, num_systems: u32) { for &component_id in components { let value: u8 = rng.gen_range(0..255); OwningPtr::make(value, |ptr| { - #[allow(unsafe_code)] + #[expect( + unsafe_code, + reason = "Used to write to a fake component that we previously set up" + )] // SAFETY: // component_id is from the same world // value is u8, so ptr is a valid reference for component_id @@ -153,8 +162,7 @@ fn stress_test(num_entities: u32, num_components: u32, num_systems: u32) { app.run(); } -#[expect(missing_docs)] -pub fn main() { +fn main() { const DEFAULT_NUM_ENTITIES: u32 = 50000; const DEFAULT_NUM_COMPONENTS: u32 = 1000; const DEFAULT_NUM_SYSTEMS: u32 = 800; diff --git a/examples/stress_tests/transform_hierarchy.rs b/examples/stress_tests/transform_hierarchy.rs index 91ed3405fb437..67448051e7547 100644 --- a/examples/stress_tests/transform_hierarchy.rs +++ b/examples/stress_tests/transform_hierarchy.rs @@ -212,7 +212,6 @@ struct Cfg { update_filter: UpdateFilter, } -#[allow(unused)] #[derive(Debug, Clone)] enum TestCase { /// a uniform tree, exponentially growing with depth diff --git a/src/lib.rs b/src/lib.rs index 6cdd5f4f9d6ce..29f7cc5cc7a74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(clippy::single_component_path_imports)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] //! [![Bevy Logo](https://bevyengine.org/assets/bevy_logo_docs.svg)](https://bevyengine.org) @@ -50,5 +49,9 @@ pub use bevy_internal::*; // Wasm does not support dynamic linking. #[cfg(all(feature = "dynamic_linking", not(target_family = "wasm")))] -#[allow(unused_imports)] +#[expect( + unused_imports, + clippy::single_component_path_imports, + reason = "This causes bevy to be compiled as a dylib when using dynamic linking, and as such cannot be removed or changed without affecting dynamic linking." +)] use bevy_dylib;