fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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