2019-08-04 01:24:23 -05:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
#![warn(clippy::unnecessary_cast)]
|
2022-01-13 06:18:19 -06:00
|
|
|
#![allow(
|
|
|
|
clippy::no_effect,
|
|
|
|
clippy::unnecessary_operation,
|
|
|
|
clippy::nonstandard_macro_braces,
|
|
|
|
clippy::borrow_as_ptr
|
|
|
|
)]
|
2019-08-04 01:24:23 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// casting integer literal to float is unnecessary
|
|
|
|
100 as f32;
|
|
|
|
100 as f64;
|
|
|
|
100_i32 as f64;
|
2020-10-28 17:36:07 -05:00
|
|
|
let _ = -100 as f32;
|
|
|
|
let _ = -100 as f64;
|
|
|
|
let _ = -100_i32 as f64;
|
2020-12-06 08:01:03 -06:00
|
|
|
100. as f32;
|
|
|
|
100. as f64;
|
2019-08-04 01:24:23 -05:00
|
|
|
// Should not trigger
|
|
|
|
#[rustfmt::skip]
|
|
|
|
let v = vec!(1);
|
|
|
|
&v as &[i32];
|
2020-03-03 10:05:09 -06:00
|
|
|
0x10 as f32;
|
|
|
|
0o10 as f32;
|
|
|
|
0b10 as f32;
|
|
|
|
0x11 as f64;
|
|
|
|
0o11 as f64;
|
|
|
|
0b11 as f64;
|
2020-10-28 17:36:07 -05:00
|
|
|
|
|
|
|
1 as u32;
|
|
|
|
0x10 as i32;
|
|
|
|
0b10 as usize;
|
|
|
|
0o73 as u16;
|
|
|
|
1_000_000_000 as u32;
|
|
|
|
|
|
|
|
1.0 as f64;
|
|
|
|
0.5 as f32;
|
|
|
|
|
|
|
|
1.0 as u16;
|
|
|
|
|
|
|
|
let _ = -1 as i32;
|
|
|
|
let _ = -1.0 as f32;
|
2019-08-04 01:24:23 -05:00
|
|
|
}
|