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
Also, is this lint deprecated, while still being reported?
$ cargo clippy --all-targets -- -A precedence
Checking rand_core v0.9.0-beta.1 (/home/dhardy/projects/rand/rand/rand_core)
warning: lint name `precedence` is deprecated and may not have an effect in the future
|
= help: change it to clippy::precedence
= note: requested on the command line with `-A precedence`
= note: `#[warn(renamed_and_removed_lints)]` on by default
warning: operator precedence can trip the unwary
--> rand_core/src/block.rs:200:13
|
200 | u64::from(data[1]) << 32 | u64::from(data[0])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(u64::from(data[1]) << 32) | u64::from(data[0])`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
= note: `#[warn(clippy::precedence)]` on by default
Description
The precedence lint flags some stuff which is (IMO) unintuitive:
But also some stuff which is (again, IMO) clearer:
The lint does not flag some stuff which is widely understood:
The lint documentation could be more precise about which operator combinations get flagged, with a link to the reference on operator expression precedence.
Further, the lint could be disagglomerated or adjusted to allow the bit-shift with binary-and/or/xor case above.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: