-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New lint: precedence_bits
, with recent additions to precedence
#14115
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
533c75e
to
17874da
Compare
Commit 2550530 has extended the `precedence` lint to include bitmasking and shift operations. The lint is warn by default, and this generates many hits, especially in embedded or system code, where it is very idiomatic to use expressions such as `1 << 3 | 1 << 5` without parentheses. This commit splits the recent addition into a new lint, which is put into the "restriction" category, while the original one stays in "complexity", because mixing bitmasking and arithmetic operations is less typical.
17874da
to
8db9ecf
Compare
Agree. I'll merge this right away without a FCP because I understand that we're reducing a lot of churn, and we want to do that quickly. |
smalis-msft
added a commit
to microsoft/openvmm
that referenced
this pull request
Feb 20, 2025
Mostly cleaning up some more map_ors, but the one big change of note is temporarily allowing the clippy:precedence lint. Previously this lint only applied to arithmetic operations, however a change in 1.85 causes it to apply to bitwise operations as well. This is overly noisy, and unnecessary. And the clippy maintainers agree, as they've since split out this change into a separate lint, precedence_bits, that is allow-by-default. However that split will not be present until 1.86. See rust-lang/rust-clippy#14115 for details on that.
Yarwin
added a commit
to Yarwin/gdext
that referenced
this pull request
Feb 22, 2025
- Allow clippy::precedence which includes bitmasking and shift operations in Rust 1.85. This behaviour will be reverted in 1.86: rust-lang/rust-clippy#14115.
Yarwin
added a commit
to Yarwin/gdext
that referenced
this pull request
Feb 22, 2025
- Allow clippy::precedence which includes bitmasking and shift operations in Rust 1.85. This behaviour will be reverted in 1.86: rust-lang/rust-clippy#14115.
averms
added a commit
to averms/glvs
that referenced
this pull request
Mar 25, 2025
Specifically when rust-lang/rust-clippy#14115 is shipped.
averms
added a commit
to averms/glvs
that referenced
this pull request
Mar 25, 2025
Specifically when rust-lang/rust-clippy#14115 is shipped.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit 2550530 has extended the
precedence
lint to include bitmasking and shift operations. The lint is warn by default, and this generates many hits, especially in embedded or system code, where it is very idiomatic to use expressions such as1 << 3 | 1 << 5
without parentheses.This commit splits the recent addition into a new lint, which is put into the "restriction" category, while the original one stays in "complexity", because mixing bitmasking and arithmetic operations is less typical.
Fix #14097
changelog: [
precedence_bits
]: new lint