2019-08-04 01:24:23 -05:00
|
|
|
#![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);
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
// do not lint cast to cfg-dependant type
|
|
|
|
1 as std::os::raw::c_char;
|
2019-08-04 01:24:23 -05:00
|
|
|
}
|