]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/mistyped_literal_suffix.rs
Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors
[rust.git] / src / tools / clippy / tests / ui / mistyped_literal_suffix.rs
1 // run-rustfix
2 // aux-build: proc_macro_with_span.rs
3
4 #![allow(
5     dead_code,
6     unused_variables,
7     overflowing_literals,
8     clippy::excessive_precision,
9     clippy::inconsistent_digit_grouping,
10     clippy::unusual_byte_groupings
11 )]
12
13 extern crate proc_macro_with_span;
14 use proc_macro_with_span::with_span;
15
16 fn main() {
17     let fail14 = 2_32;
18     let fail15 = 4_64;
19     let fail16 = 7_8; //
20     let fail17 = 23_16; //
21     let ok18 = 23_128;
22
23     let fail20 = 2__8; //
24     let fail21 = 4___16; //
25
26     let ok24 = 12.34_64;
27     let fail25 = 1E2_32;
28     let fail26 = 43E7_64;
29     let fail27 = 243E17_32;
30     let fail28 = 241251235E723_64;
31     let ok29 = 42279.911_32;
32
33     // testing that the suggestion actually fits in its type
34     let fail30 = 127_8; // should be i8
35     let fail31 = 240_8; // should be u8
36     let ok32 = 360_8; // doesnt fit in either, should be ignored
37     let fail33 = 0x1234_16;
38     let fail34 = 0xABCD_16;
39     let ok35 = 0x12345_16;
40     let fail36 = 0xFFFF_FFFF_FFFF_FFFF_64; // u64
41
42     // issue #6129
43     let ok37 = 123_32.123;
44     let ok38 = 124_64.0;
45
46     let _ = 1.12345E1_32;
47
48     let _ = with_span!(1 2_u32);
49 }