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_core_pipeline: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] #17137

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LikeLakers2
Copy link
Contributor

@LikeLakers2 LikeLakers2 commented Jan 4, 2025

Objective

Solution

Set the clippy::allow_attributes and clippy::allow_attributes_without_reason lints to deny, and bring bevy_core_pipeline 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

cargo clippy and cargo test --package bevy_core_pipeline were run, and no errors were encountered.

@LikeLakers2 LikeLakers2 changed the title Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to bevy_core_pipeline bevy_core_pipeline: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] Jan 4, 2025
@BenjaminBrienen BenjaminBrienen added D-Trivial Nice and easy! A great choice to get started with Bevy A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Code-Quality A section of code that is hard to understand or change labels Jan 4, 2025
@BenjaminBrienen
Copy link
Contributor

I'll review after #16338 merged and this is updated to fix the conflict :)

#[expect(
clippy::needless_range_loop,
reason = "This for-loop also uses `i` to calculate a value `t`."
)]
Copy link
Contributor Author

@LikeLakers2 LikeLakers2 Jan 4, 2025

Choose a reason for hiding this comment

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

I want to mention: I actually spent some time seeing if I could rewrite this loop to use an iterator (as the lint suggests to do).

However, I ultimately opted not to do so, as I found that I couldn't easily get i to be the same values without some very awkward-looking code.

I don't believe it's impossible to make an iterator work here though.

Copy link

@Bleachfuel Bleachfuel Jan 4, 2025

Choose a reason for hiding this comment

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

maybe

let iter  = lut_begin.ceil() as usize..=lut_end.floor() as usize

for i in iter {
}

seems a bit unnessecary tbh.

Copy link
Contributor Author

@LikeLakers2 LikeLakers2 Jan 4, 2025

Choose a reason for hiding this comment

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

For what it's worth, that would silence the lint - but I suspect that that's a false negative with clippy. Hence, I don't think it would be a good idea compared to just silencing the lint as I have.

Copy link

@Bleachfuel Bleachfuel left a comment

Choose a reason for hiding this comment

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

Those Impls seem double to me.

#[expect(
clippy::needless_range_loop,
reason = "This for-loop also uses `i` to calculate a value `t`."
)]
Copy link

@Bleachfuel Bleachfuel Jan 4, 2025

Choose a reason for hiding this comment

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

maybe

let iter  = lut_begin.ceil() as usize..=lut_end.floor() as usize

for i in iter {
}

seems a bit unnessecary tbh.

crates/bevy_core_pipeline/src/core_2d/camera_2d.rs Outdated Show resolved Hide resolved
@LikeLakers2 LikeLakers2 marked this pull request as draft January 5, 2025 10:33
@LikeLakers2
Copy link
Contributor Author

This PR is blocked on #16338 per Benjamin's request. Once that is merged, I will fix any conflicts and mark it as ready to merge.

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Your PR increases Bevy Minimum Supported Rust Version. Please update the rust-version field in the root Cargo.toml file.

@LikeLakers2
Copy link
Contributor Author

No longer blocked by #16338 but I am personally blocking this on #17185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change D-Trivial Nice and easy! A great choice to get started with Bevy S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants