mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
38d4ac7cea
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
29 lines
667 B
Rust
29 lines
667 B
Rust
#[warn(
|
|
clippy::cast_precision_loss,
|
|
clippy::cast_possible_truncation,
|
|
clippy::cast_sign_loss,
|
|
clippy::cast_possible_wrap,
|
|
clippy::cast_lossless
|
|
)]
|
|
#[allow(clippy::no_effect, clippy::unnecessary_operation)]
|
|
fn main() {
|
|
// Casting from *size
|
|
1isize as i8;
|
|
1isize as f64;
|
|
1usize as f64;
|
|
1isize as f32;
|
|
1usize as f32;
|
|
1isize as i32;
|
|
1isize as u32;
|
|
1usize as u32;
|
|
1usize as i32;
|
|
// Casting to *size
|
|
1i64 as isize;
|
|
1i64 as usize;
|
|
1u64 as isize;
|
|
1u64 as usize;
|
|
1u32 as isize;
|
|
1u32 as usize; // Should not trigger any lint
|
|
1i32 as isize; // Neither should this
|
|
1i32 as usize;
|
|
}
|