mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +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
23 lines
429 B
Rust
23 lines
429 B
Rust
#![warn(clippy::unnecessary_cast)]
|
|
#![allow(clippy::no_effect)]
|
|
|
|
fn main() {
|
|
// Test cast_unnecessary
|
|
1i32 as i32;
|
|
1f32 as f32;
|
|
false as bool;
|
|
&1i32 as &i32;
|
|
|
|
// macro version
|
|
macro_rules! foo {
|
|
($a:ident, $b:ident) => {
|
|
#[allow(unused)]
|
|
pub fn $a() -> $b {
|
|
1 as $b
|
|
}
|
|
};
|
|
}
|
|
foo!(a, i32);
|
|
foo!(b, f32);
|
|
foo!(c, f64);
|
|
}
|