mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
2d84d0361d
This splits up the cast.rs tests and enables rustfix tests for the part of the `unnecessary_cast` lint that emits `MachineApplicable` suggestions. cc #3630
17 lines
349 B
Rust
17 lines
349 B
Rust
// run-rustfix
|
|
|
|
#![warn(clippy::unnecessary_cast)]
|
|
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
|
|
|
|
fn main() {
|
|
// casting integer literal to float is unnecessary
|
|
100 as f32;
|
|
100 as f64;
|
|
100_i32 as f64;
|
|
// Should not trigger
|
|
#[rustfmt::skip]
|
|
let v = vec!(1);
|
|
&v as &[i32];
|
|
1.0 as f64;
|
|
1 as u64;
|
|
}
|