]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #![warn(clippy::unnecessary_cast)] |
2 | #![allow(clippy::no_effect)] | |
3 | ||
4 | fn main() { | |
5 | // Test cast_unnecessary | |
6 | 1i32 as i32; | |
7 | 1f32 as f32; | |
8 | false as bool; | |
9 | &1i32 as &i32; | |
10 | ||
11 | // macro version | |
12 | macro_rules! foo { | |
13 | ($a:ident, $b:ident) => { | |
14 | #[allow(unused)] | |
15 | pub fn $a() -> $b { | |
16 | 1 as $b | |
17 | } | |
18 | }; | |
19 | } | |
20 | foo!(a, i32); | |
21 | foo!(b, f32); | |
22 | foo!(c, f64); | |
23 | ||
24 | // do not lint cast to cfg-dependant type | |
25 | 1 as std::os::raw::c_char; | |
26 | } |