rust-clippy/tests/ui/manual_bits.fixed

49 lines
792 B
Rust
Raw Normal View History

// run-rustfix
#![warn(clippy::manual_bits)]
#![allow(clippy::no_effect, path_statements, unused_must_use, clippy::unnecessary_operation)]
use std::mem::{size_of, size_of_val};
fn main() {
i8::BITS;
i16::BITS;
i32::BITS;
i64::BITS;
i128::BITS;
isize::BITS;
u8::BITS;
u16::BITS;
u32::BITS;
u64::BITS;
u128::BITS;
usize::BITS;
i8::BITS;
i16::BITS;
i32::BITS;
i64::BITS;
i128::BITS;
isize::BITS;
u8::BITS;
u16::BITS;
u32::BITS;
u64::BITS;
u128::BITS;
usize::BITS;
size_of::<usize>() * 4;
4 * size_of::<usize>();
size_of::<bool>() * 8;
8 * size_of::<bool>();
size_of_val(&0u32) * 8;
type Word = u32;
Word::BITS;
type Bool = bool;
size_of::<Bool>() * 8;
}