]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/mistyped_literal_suffix.fixed
Rollup merge of #96733 - SparrowLii:place_to_string, r=davidtwco
[rust.git] / src / tools / clippy / tests / ui / mistyped_literal_suffix.fixed
1 // run-rustfix
2
3 #![allow(
4     dead_code,
5     unused_variables,
6     overflowing_literals,
7     clippy::excessive_precision,
8     clippy::inconsistent_digit_grouping,
9     clippy::unusual_byte_groupings
10 )]
11
12 fn main() {
13     let fail14 = 2_i32;
14     let fail15 = 4_i64;
15     let fail16 = 7_i8; //
16     let fail17 = 23_i16; //
17     let ok18 = 23_128;
18
19     let fail20 = 2_i8; //
20     let fail21 = 4_i16; //
21
22     let ok24 = 12.34_64;
23     let fail25 = 1E2_f32;
24     let fail26 = 43E7_f64;
25     let fail27 = 243E17_f32;
26     let fail28 = 241_251_235E723_f64;
27     let ok29 = 42279.911_32;
28
29     // testing that the suggestion actually fits in its type
30     let fail30 = 127_i8; // should be i8
31     let fail31 = 240_u8; // should be u8
32     let ok32 = 360_8; // doesnt fit in either, should be ignored
33     let fail33 = 0x1234_i16;
34     let fail34 = 0xABCD_u16;
35     let ok35 = 0x12345_16;
36     let fail36 = 0xFFFF_FFFF_FFFF_FFFF_u64; // u64
37
38     // issue #6129
39     let ok37 = 123_32.123;
40     let ok38 = 124_64.0;
41
42     let _ = 1.123_45E1_f32;
43 }