-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
bevy_gltf: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
#17280
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
Changes from all commits
b89096d
fb8f44e
cd17240
3793bda
a7cc6b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,7 +454,10 @@ async fn load_gltf<'a, 'b, 'c>( | |
| ReadOutputs::MorphTargetWeights(weights) => { | ||
| let weights: Vec<f32> = weights.into_f32().collect(); | ||
| if keyframe_timestamps.len() == 1 { | ||
| #[allow(clippy::unnecessary_map_on_constructor)] | ||
| #[expect( | ||
| clippy::unnecessary_map_on_constructor, | ||
| reason = "While the mapping is unnecessary, it is much more readable at this level of indentation. Additionally, mapping makes it more consistent with the other branches." | ||
| )] | ||
| Some(ConstantCurve::new(Interval::EVERYWHERE, weights)) | ||
| .map(WeightsCurve) | ||
| .map(VariableCurve::new) | ||
|
|
@@ -1368,7 +1371,10 @@ fn warn_on_differing_texture_transforms( | |
| } | ||
|
|
||
| /// Loads a glTF node. | ||
| #[allow(clippy::result_large_err)] | ||
| #[expect( | ||
| clippy::result_large_err, | ||
| reason = "`GltfError` is only barely past the threshold for large errors." | ||
| )] | ||
| fn load_node( | ||
| gltf_node: &Node, | ||
| world_builder: &mut WorldChildBuilder, | ||
|
|
@@ -1723,7 +1729,10 @@ fn texture_handle(load_context: &mut LoadContext, texture: &gltf::Texture) -> Ha | |
| /// | ||
| /// This is a low-level function only used when the `gltf` crate has no support | ||
| /// for an extension, forcing us to parse its texture references manually. | ||
| #[allow(dead_code)] | ||
| #[cfg(any( | ||
| feature = "pbr_anisotropy_texture", | ||
| feature = "pbr_multi_layer_material_textures" | ||
| ))] | ||
| fn texture_handle_from_info( | ||
| load_context: &mut LoadContext, | ||
| document: &Document, | ||
|
|
@@ -1806,7 +1815,10 @@ fn texture_address_mode(gltf_address_mode: &WrappingMode) -> ImageAddressMode { | |
| } | ||
|
|
||
| /// Maps the `primitive_topology` form glTF to `wgpu`. | ||
| #[allow(clippy::result_large_err)] | ||
| #[expect( | ||
| clippy::result_large_err, | ||
| reason = "`GltfError` is only barely past the threshold for large errors." | ||
| )] | ||
| fn get_primitive_topology(mode: Mode) -> Result<PrimitiveTopology, GltfError> { | ||
| match mode { | ||
| Mode::Points => Ok(PrimitiveTopology::PointList), | ||
|
|
@@ -1876,7 +1888,10 @@ struct GltfTreeIterator<'a> { | |
| } | ||
|
|
||
| impl<'a> GltfTreeIterator<'a> { | ||
| #[allow(clippy::result_large_err)] | ||
| #[expect( | ||
| clippy::result_large_err, | ||
| reason = "`GltfError` is only barely past the threshold for large errors." | ||
| )] | ||
| fn try_new(gltf: &'a gltf::Gltf) -> Result<Self, GltfError> { | ||
| let nodes = gltf.nodes().collect::<Vec<_>>(); | ||
|
|
||
|
|
@@ -2088,7 +2103,14 @@ struct ClearcoatExtension { | |
| } | ||
|
|
||
| impl ClearcoatExtension { | ||
| #[allow(unused_variables)] | ||
| #[expect( | ||
| clippy::allow_attributes, | ||
| reason = "`unused_variables` is not always linted" | ||
| )] | ||
| #[allow( | ||
| unused_variables, | ||
| reason = "Depending on what features are used to compile this crate, certain parameters may end up unused." | ||
| )] | ||
| fn parse( | ||
| load_context: &mut LoadContext, | ||
| document: &Document, | ||
|
|
@@ -2171,7 +2193,14 @@ struct AnisotropyExtension { | |
| } | ||
|
|
||
| impl AnisotropyExtension { | ||
| #[allow(unused_variables)] | ||
| #[expect( | ||
| clippy::allow_attributes, | ||
| reason = "`unused_variables` is not always linted" | ||
| )] | ||
| #[allow( | ||
| unused_variables, | ||
| reason = "Depending on what features are used to compile this crate, certain parameters may end up unused." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can add feature gates to parameters. This would be a usability improvement for callers using those feature combinations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| )] | ||
| fn parse( | ||
| load_context: &mut LoadContext, | ||
| document: &Document, | ||
|
|
@@ -2305,7 +2334,10 @@ mod test { | |
| } | ||
|
|
||
| fn load_gltf_into_app(gltf_path: &str, gltf: &str) -> App { | ||
| #[expect(unused)] | ||
| #[expect( | ||
| dead_code, | ||
| reason = "This struct is used to keep the handle alive. As such, we have no need to handle the handle directly." | ||
| )] | ||
| #[derive(Resource)] | ||
| struct GltfHandle(Handle<Gltf>); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add feature gates to parameters. This is a usability improvement for callers using those feature combinations.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClearcoatExtension(the struct this lint is in) is not a public struct, and this method is only called in one place; thus, there wouldn't be much of a point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im general, if the values at the call-sites aren't needed, it means that the caller can do less work to prepare arguments for the function. See how we festure gate render and text within bevy-ui. I'll approve this since it doesn't need to be addressed in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yeah, even if we wanted to feature-gate it, I feel like that'd be work for a different PR.