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
Starting in Rust 1.51, all integer types will have a ::BITS constant for the number of bits in the type. std::mem::size_of::<usize>() * 8 can be replaced with usize::BITS and similarly for all signed and unisigned integers. This lint suggests such a change.
Categories (optional)
Kind: clippy::style
What is the advantage of the recommended code over the original code
For example:
One fewer function call (saving several nanoseconds)
Easier to read
Drawbacks
None.
Example
std::mem::size_of::<usize>()*8
Could be written as:
usize::BITS
The text was updated successfully, but these errors were encountered:
What it does
Starting in Rust 1.51, all integer types will have a ::BITS constant for the number of bits in the type.
std::mem::size_of::<usize>() * 8
can be replaced withusize::BITS
and similarly for all signed and unisigned integers. This lint suggests such a change.Categories (optional)
What is the advantage of the recommended code over the original code
For example:
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: