]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/unnecessary_cast.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / unnecessary_cast.rs
CommitLineData
f20569fa
XL
1#![warn(clippy::unnecessary_cast)]
2#![allow(clippy::no_effect)]
3
4fn 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}