-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
bevy_reflect: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
#17092
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_reflect: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
#17092
Conversation
…ttributes_without_reason)]` to `bevy_reflect`
#![allow(unused_qualifications)] | ||
#![expect( | ||
unused_qualifications, | ||
reason = "Temporary workaround for impl_reflect!(Option/Result false-positive" |
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.
I don't understand the parenthesis here
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.
Yeah, I'd like to clean this up before merging. @MrGVSV, what did you mean here?
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.
This actually wasn't me. Looks like it was added in #14828. My guess is that since Option
and Result
are in the prelude, their full qualification is unnecessary, but we rely on it for generating the TypePath
impl within impl_reflect!
.
@@ -199,7 +199,7 @@ mod tests { | |||
|
|||
#[reflect_trait] | |||
trait Enemy: Reflect + Debug { | |||
#[allow(dead_code, reason = "this method is purely for testing purposes")] | |||
#[expect(dead_code, reason = "this method is purely for testing purposes")] |
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.
This method may become used during said testing, and it would be annoying if this generated a warning during testing.
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.
I think I prefer leaving this as an expect for now.
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.
Doesn't make things worse; no reason to block on fixing that weird comment.
#[deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
#![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
…ttributes_without_reason)]` (bevyengine#17092) # Objective We want to deny the following lints: * `clippy::allow_attributes` - Because there's no reason to `#[allow(...)]` an attribute if it wouldn't lint against anything; you should always use `#[expect(...)]` * `clippy::allow_attributes_without_reason` - Because documenting the reason for allowing/expecting a lint is always good ## Solution Set the `clippy::allow_attributes` and `clippy::allow_attributes_without_reason` lints to `deny`, and bring `bevy_reflect` in line with the new restrictions. No code changes have been made - except if a lint that was previously `allow(...)`'d could be removed via small code changes. For example, `unused_variables` can be handled by adding a `_` to the beginning of a field's name. ## Testing I ran `cargo clippy`, and received no errors.
Objective
We want to deny the following lints:
clippy::allow_attributes
- Because there's no reason to#[allow(...)]
an attribute if it wouldn't lint against anything; you should always use#[expect(...)]
clippy::allow_attributes_without_reason
- Because documenting the reason for allowing/expecting a lint is always goodSolution
Set the
clippy::allow_attributes
andclippy::allow_attributes_without_reason
lints todeny
, and bringbevy_reflect
in line with the new restrictions.No code changes have been made - except if a lint that was previously
allow(...)
'd could be removed via small code changes. For example,unused_variables
can be handled by adding a_
to the beginning of a field's name.Testing
I ran
cargo clippy
, and received no errors.