]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/cast_size_32bit.rs
Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors
[rust.git] / src / tools / clippy / tests / ui / cast_size_32bit.rs
1 // ignore-64bit
2 #[warn(
3     clippy::cast_precision_loss,
4     clippy::cast_possible_truncation,
5     clippy::cast_sign_loss,
6     clippy::cast_possible_wrap,
7     clippy::cast_lossless
8 )]
9 #[allow(clippy::no_effect, clippy::unnecessary_operation)]
10 fn main() {
11     // Casting from *size
12     1isize as i8;
13     let x0 = 1isize;
14     let x1 = 1usize;
15     x0 as f64;
16     x1 as f64;
17     x0 as f32;
18     x1 as f32;
19     1isize as i32;
20     1isize as u32;
21     1usize as u32;
22     1usize as i32;
23     // Casting to *size
24     1i64 as isize;
25     1i64 as usize;
26     1u64 as isize;
27     1u64 as usize;
28     1u32 as isize;
29     1u32 as usize; // Should not trigger any lint
30     1i32 as isize; // Neither should this
31     1i32 as usize;
32     // Big integer literal to float
33     999_999_999 as f32;
34     3_999_999_999usize as f64;
35 }