You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really appreciate the part of clippy::precedence that flags "mixed usage of arithmetic and bit shifting/combining operators without parentheses" (e.g. 1 << 2 + 3).
I would rather not have the part of clippy::precedence that flags "mixed usage of bitmasking and bit shifting operators without parentheses", because when you work with bitmasking regularly, it's reasonably well-known that x | 1 << 10 or y & 1 << 10 has the precedence you would expect.
Could clippy separate these into two separate lints, e.g. clippy::precedence_arithmetic_vs_bits and clippy::precedence_bits?
(I would also make the case that the latter should be allow-by-default, but for this issue I'm just requesting that the two be split.)
The text was updated successfully, but these errors were encountered:
Agreed, as doing a lot of embedded programming and bit manipulation, this bugs me as well. I think the lint on shifting/combining operators should be in restriction.
…14115)
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.
Fix#14097
changelog: [`precedence_bits`]: new lint
I really appreciate the part of
clippy::precedence
that flags "mixed usage of arithmetic and bit shifting/combining operators without parentheses" (e.g.1 << 2 + 3
).I would rather not have the part of
clippy::precedence
that flags "mixed usage of bitmasking and bit shifting operators without parentheses", because when you work with bitmasking regularly, it's reasonably well-known thatx | 1 << 10
ory & 1 << 10
has the precedence you would expect.Could clippy separate these into two separate lints, e.g.
clippy::precedence_arithmetic_vs_bits
andclippy::precedence_bits
?(I would also make the case that the latter should be allow-by-default, but for this issue I'm just requesting that the two be split.)
The text was updated successfully, but these errors were encountered: