diff --git a/crates/bevy_pbr/src/extended_material.rs b/crates/bevy_pbr/src/extended_material.rs index 1b2d48e4c69f9..35cb1129d26fb 100644 --- a/crates/bevy_pbr/src/extended_material.rs +++ b/crates/bevy_pbr/src/extended_material.rs @@ -37,7 +37,6 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Returns this material's fragment shader. If [`ShaderRef::Default`] is returned, the base material mesh fragment shader /// will be used. - #[allow(unused_variables)] fn fragment_shader() -> ShaderRef { ShaderRef::Default } @@ -50,7 +49,6 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Returns this material's prepass fragment shader. If [`ShaderRef::Default`] is returned, the base material prepass fragment shader /// will be used. - #[allow(unused_variables)] fn prepass_fragment_shader() -> ShaderRef { ShaderRef::Default } @@ -63,14 +61,12 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Returns this material's prepass fragment shader. If [`ShaderRef::Default`] is returned, the base material deferred fragment shader /// will be used. - #[allow(unused_variables)] fn deferred_fragment_shader() -> ShaderRef { ShaderRef::Default } /// Returns this material's [`crate::meshlet::MeshletMesh`] fragment shader. If [`ShaderRef::Default`] is returned, /// the default meshlet mesh fragment shader will be used. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -78,7 +74,6 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Returns this material's [`crate::meshlet::MeshletMesh`] prepass fragment shader. If [`ShaderRef::Default`] is returned, /// the default meshlet mesh prepass fragment shader will be used. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_prepass_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -86,7 +81,6 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Returns this material's [`crate::meshlet::MeshletMesh`] deferred fragment shader. If [`ShaderRef::Default`] is returned, /// the default meshlet mesh deferred fragment shader will be used. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_deferred_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -95,7 +89,10 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// Customizes the default [`RenderPipelineDescriptor`] for a specific entity using the entity's /// [`MaterialPipelineKey`] and [`MeshVertexBufferLayoutRef`] as input. /// Specialization for the base material is applied before this function is called. - #[allow(unused_variables)] + #[expect( + unused_variables, + reason = "The parameters here are intentionally unused by the default implementation; however, putting underscores here will result in the underscores being copied by rust-analyzer's tab completion." + )] #[inline] fn specialize( pipeline: &MaterialExtensionPipeline, diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 15f8795ffbac4..ec67b70c8b501 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -1,6 +1,11 @@ #![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] -#![deny(unsafe_code)] +#![forbid(unsafe_code)] +#![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" diff --git a/crates/bevy_pbr/src/light_probe/mod.rs b/crates/bevy_pbr/src/light_probe/mod.rs index 4961983ecd383..75bf47b5ce61a 100644 --- a/crates/bevy_pbr/src/light_probe/mod.rs +++ b/crates/bevy_pbr/src/light_probe/mod.rs @@ -185,7 +185,6 @@ pub struct ViewLightProbesUniformOffset(u32); /// This information is parameterized by the [`LightProbeComponent`] type. This /// will either be [`EnvironmentMapLight`] for reflection probes or /// [`IrradianceVolume`] for irradiance volumes. -#[allow(dead_code)] struct LightProbeInfo where C: LightProbeComponent, diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 362b4b6d31020..5324d77d1fc3d 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -124,7 +124,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// Returns this material's fragment shader. If [`ShaderRef::Default`] is returned, the default mesh fragment shader /// will be used. - #[allow(unused_variables)] fn fragment_shader() -> ShaderRef { ShaderRef::Default } @@ -174,7 +173,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// /// This is used for the various [prepasses](bevy_core_pipeline::prepass) as well as for generating the depth maps /// required for shadow mapping. - #[allow(unused_variables)] fn prepass_fragment_shader() -> ShaderRef { ShaderRef::Default } @@ -187,7 +185,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// Returns this material's deferred fragment shader. If [`ShaderRef::Default`] is returned, the default deferred fragment shader /// will be used. - #[allow(unused_variables)] fn deferred_fragment_shader() -> ShaderRef { ShaderRef::Default } @@ -198,7 +195,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// This is part of an experimental feature, and is unnecessary to implement unless you are using `MeshletMesh`'s. /// /// See [`crate::meshlet::MeshletMesh`] for limitations. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -210,7 +206,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// This is part of an experimental feature, and is unnecessary to implement unless you are using `MeshletMesh`'s. /// /// See [`crate::meshlet::MeshletMesh`] for limitations. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_prepass_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -222,7 +217,6 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// This is part of an experimental feature, and is unnecessary to implement unless you are using `MeshletMesh`'s. /// /// See [`crate::meshlet::MeshletMesh`] for limitations. - #[allow(unused_variables)] #[cfg(feature = "meshlet")] fn meshlet_mesh_deferred_fragment_shader() -> ShaderRef { ShaderRef::Default @@ -230,7 +224,10 @@ pub trait Material: Asset + AsBindGroup + Clone + Sized { /// Customizes the default [`RenderPipelineDescriptor`] for a specific entity using the entity's /// [`MaterialPipelineKey`] and [`MeshVertexBufferLayoutRef`] as input. - #[allow(unused_variables)] + #[expect( + unused_variables, + reason = "The parameters here are intentionally unused by the default implementation; however, putting underscores here will result in the underscores being copied by rust-analyzer's tab completion." + )] #[inline] fn specialize( pipeline: &MaterialPipeline, diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index d2271b9b38b67..96c88702312e9 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -752,17 +752,9 @@ fn prepare_ssao_bind_groups( } } -#[allow(clippy::needless_range_loop)] fn generate_hilbert_index_lut() -> [[u16; 64]; 64] { - let mut t = [[0; 64]; 64]; - - for x in 0..64 { - for y in 0..64 { - t[x][y] = hilbert_index(x as u16, y as u16); - } - } - - t + use core::array::from_fn; + from_fn(|x| from_fn(|y| hilbert_index(x as u16, y as u16))) } // https://www.shadertoy.com/view/3tB3z3