RS.CLIPPY.MANUAL_ROTATE
Using bit shifts to rotate integers
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: manual_rotate. Copyright ©2025 The Rust Team. All rights reserved.
What it does
It detects manual bit rotations that could be rewritten using standard
functions rotate_left or rotate_right.
Why is this bad?
Calling the function better conveys the intent.
Known issues
Currently, the lint only catches shifts by constant amount.
Example
let x = 12345678_u32;
let _ = (x >> 8) | (x << 24);
Use instead:
let x = 12345678_u32;
let _ = x.rotate_right(8);