-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsT-ASTType: Requires working with the ASTType: Requires working with the ASTgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
What it does
Consider this code snippet:
pub const fn to_4_be_nibles(op: u16) -> [u8; 4] {
[
(op & 0xF000 >> 12) as u8,
(op & 0x0F00 >> 8) as u8,
(op & 0x00F0 >> 4) as u8,
(op & 0x000F) as u8,
]
}
We'd realize that the code is wrong. >>
has stronger precedence than &
operator.
So we has to use ()
to group (op & 0F000)
and the like.
I'd like to have a lint about this.
Categories (optional)
- Kind: clippy::correctness
Drawbacks
None.
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsT-ASTType: Requires working with the ASTType: Requires working with the ASTgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy