]> git.lizzy.rs Git - rust.git/blob - tests/ui/cast_lossless_integer.rs
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
[rust.git] / tests / ui / cast_lossless_integer.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 // run-rustfix
11
12 #[warn(clippy::cast_lossless)]
13 #[allow(clippy::no_effect, clippy::unnecessary_operation)]
14 fn main() {
15     // Test clippy::cast_lossless with casts to integer types
16     1i8 as i16;
17     1i8 as i32;
18     1i8 as i64;
19     1u8 as i16;
20     1u8 as i32;
21     1u8 as i64;
22     1u8 as u16;
23     1u8 as u32;
24     1u8 as u64;
25     1i16 as i32;
26     1i16 as i64;
27     1u16 as i32;
28     1u16 as i64;
29     1u16 as u32;
30     1u16 as u64;
31     1i32 as i64;
32     1u32 as i64;
33     1u32 as u64;
34 }