]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // run-rustfix |
2 | #[warn(clippy::inconsistent_digit_grouping)] | |
3 | #[deny(clippy::unreadable_literal)] | |
4 | #[allow(unused_variables, clippy::excessive_precision)] | |
5 | fn main() { | |
6 | macro_rules! mac1 { | |
7 | () => { | |
8 | 1_23_456 | |
9 | }; | |
10 | } | |
11 | macro_rules! mac2 { | |
12 | () => { | |
13 | 1_234.5678_f32 | |
14 | }; | |
15 | } | |
16 | ||
17 | let good = ( | |
18 | 123, | |
19 | 1_234, | |
20 | 1_2345_6789, | |
21 | 123_f32, | |
22 | 1_234.12_f32, | |
23 | 1_234.123_4_f32, | |
24 | 1.123_456_7_f32, | |
25 | ); | |
26 | let bad = (123_456, 12_345_678, 1_234_567, 1_234.567_8_f32, 1.234_567_8_f32); | |
27 | ||
28 | // Test padding | |
29 | let _ = 0x0010_0000; | |
30 | let _ = 0x0100_0000; | |
31 | let _ = 0x1000_0000; | |
32 | let _ = 0x0001_0000_0000_u64; | |
33 | ||
34 | // Test suggestion when fraction has no digits | |
35 | let _: f32 = 123_456.; | |
36 | ||
37 | // Test UUID formatted literal | |
38 | let _: u128 = 0x12345678_1234_1234_1234_123456789012; | |
39 | ||
40 | // Ignore literals in macros | |
41 | let _ = mac1!(); | |
42 | let _ = mac2!(); | |
43 | ||
44 | // Issue #6096 | |
45 | // Allow separating exponent with '_' | |
46 | let _ = 1.025_011_10_E0; | |
47 | } |