]> git.lizzy.rs Git - rust.git/blob - src/docs/manual_bits.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / manual_bits.txt
1 ### What it does
2 Checks for uses of `std::mem::size_of::<T>() * 8` when
3 `T::BITS` is available.
4
5 ### Why is this bad?
6 Can be written as the shorter `T::BITS`.
7
8 ### Example
9 ```
10 std::mem::size_of::<usize>() * 8;
11 ```
12 Use instead:
13 ```
14 usize::BITS as usize;
15 ```