Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bevy_pbr: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] #17277

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/bevy_pbr/src/extended_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -63,7 +61,6 @@ 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
}
Expand Down Expand Up @@ -95,7 +92,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,
Expand Down
7 changes: 6 additions & 1 deletion crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched through bevy_pbr, and found no unsafe code - so I figured this was meant to be a forbid.

#![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"
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/light_probe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<C>
where
C: LightProbeComponent,
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -230,7 +227,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<Self>,
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,13 @@ fn prepare_ssao_bind_groups(
}
}

#[allow(clippy::needless_range_loop)]
fn generate_hilbert_index_lut() -> [[u16; 64]; 64] {
let mut t = [[0; 64]; 64];

#[expect(
clippy::needless_range_loop,
reason = "Rewriting this loop to use iterators would make the code much harder to read for very little performance gain."
)]
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
for x in 0..64 {
for y in 0..64 {
t[x][y] = hilbert_index(x as u16, y as u16);
Expand Down
Loading