RS.CLIPPY.MANUAL_BITS
Manual implementation of `size_of::<T>() * 8` can be simplified with `T::BITS`
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_bits. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of size_of::<T>() * 8 when
T::BITS is available.
Why is this bad?
Can be written as the shorter T::BITS.
Example
size_of::<usize>() * 8;
Use instead:
usize::BITS as usize;
Configuration
-
msrv: The minimum rust version that the project supports. Defaults to therust-versionfield inCargo.toml(default:
current version)