about summary refs log tree commit diff
path: root/tests/ui/lint/lint-non-uppercase-usages.fixed
blob: 231991dcae08ce3ef6a5d64c185ccbf4ee2972de (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
43
44
// Checks that the `non_upper_case_globals` emits suggestions for usages as well
// <https://github.com/rust-lang/rust/issues/124061>

//@ check-pass
//@ run-rustfix

#![allow(dead_code)]

use std::cell::Cell;

const MY_STATIC: u32 = 0;
//~^ WARN constant `my_static` should have an upper case name
//~| SUGGESTION MY_STATIC

const LOL: u32 = MY_STATIC + 0;
//~^ SUGGESTION MY_STATIC

mod my_mod {
    const INSIDE_MOD: u32 = super::MY_STATIC + 0;
    //~^ SUGGESTION MY_STATIC
}

thread_local! {
    static FOO_FOO: Cell<usize> = unreachable!();
    //~^ WARN constant `fooFOO` should have an upper case name
    //~| SUGGESTION FOO_FOO
}

fn foo<const FOO: u32>() {
    //~^ WARN const parameter `foo` should have an upper case name
    //~| SUGGESTION FOO
    let _a = FOO + 1;
    //~^ SUGGESTION FOO
}

fn main() {
    let _a = crate::MY_STATIC;
    //~^ SUGGESTION MY_STATIC

    FOO_FOO.set(9);
    //~^ SUGGESTION FOO_FOO
    println!("{}", FOO_FOO.get());
    //~^ SUGGESTION FOO_FOO
}