2019-08-04 06:24:23 +00:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
#![warn(clippy::unnecessary_cast)]
|
2021-05-30 21:58:32 +00:00
|
|
|
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::nonstandard_macro_braces)]
|
2019-08-04 06:24:23 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// casting integer literal to float is unnecessary
|
|
|
|
100_f32;
|
|
|
|
100_f64;
|
|
|
|
100_f64;
|
2020-10-23 21:40:57 +00:00
|
|
|
let _ = -100_f32;
|
|
|
|
let _ = -100_f64;
|
|
|
|
let _ = -100_f64;
|
2020-11-22 00:08:32 +00:00
|
|
|
100_f32;
|
|
|
|
100_f64;
|
2019-08-04 06:24:23 +00:00
|
|
|
// Should not trigger
|
|
|
|
#[rustfmt::skip]
|
|
|
|
let v = vec!(1);
|
|
|
|
&v as &[i32];
|
2020-03-03 16:05:09 +00:00
|
|
|
0x10 as f32;
|
|
|
|
0o10 as f32;
|
|
|
|
0b10 as f32;
|
|
|
|
0x11 as f64;
|
|
|
|
0o11 as f64;
|
|
|
|
0b11 as f64;
|
2020-10-15 22:22:35 +00:00
|
|
|
|
|
|
|
1_u32;
|
2020-10-22 21:53:50 +00:00
|
|
|
0x10_i32;
|
|
|
|
0b10_usize;
|
|
|
|
0o73_u16;
|
|
|
|
1_000_000_000_u32;
|
2020-10-15 22:22:35 +00:00
|
|
|
|
|
|
|
1.0_f64;
|
|
|
|
0.5_f32;
|
|
|
|
|
|
|
|
1.0 as u16;
|
2020-10-22 22:04:27 +00:00
|
|
|
|
2020-10-22 22:04:27 +00:00
|
|
|
let _ = -1_i32;
|
|
|
|
let _ = -1.0_f32;
|
2019-08-04 06:24:23 +00:00
|
|
|
}
|