summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/unseparated_prefix_literals.fixed
blob: b6241612d9da9a385e2ae46715c3d9217d5315eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//@run-rustfix
//@aux-build:proc_macro_derive.rs

#![warn(clippy::unseparated_literal_suffix)]
#![allow(dead_code)]

#[macro_use]
extern crate proc_macro_derive;

// Test for proc-macro attribute
#[derive(ClippyMiniMacroTest)]
struct Foo;

macro_rules! lit_from_macro {
    () => {
        42_usize
    };
}

fn main() {
    let _ok1 = 1234_i32;
    let _ok2 = 1234_isize;
    let _ok3 = 0x123_isize;
    let _fail1 = 1234_i32;
    let _fail2 = 1234_u32;
    let _fail3 = 1234_isize;
    let _fail4 = 1234_usize;
    let _fail5 = 0x123_isize;

    let _okf1 = 1.5_f32;
    let _okf2 = 1_f32;
    let _failf1 = 1.5_f32;
    let _failf2 = 1_f32;

    // Test for macro
    let _ = lit_from_macro!();

    // Counter example
    let _ = line!();
    // Because `assert!` contains `line!()` macro.
    assert_eq!(4897_u32, 32223);
}