Use one message for uppercase global lint
This commit is contained in:
parent
72399f2db7
commit
066d62d4b4
src
@ -355,10 +355,7 @@ impl LintPass for NonUpperCaseGlobals {
|
||||
impl LateLintPass for NonUpperCaseGlobals {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemStatic(_, hir::MutImmutable, _) => {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "static constant", it.name, it.span);
|
||||
}
|
||||
hir::ItemStatic(_, hir::MutMutable, _) => {
|
||||
hir::ItemStatic(..) => {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span);
|
||||
}
|
||||
hir::ItemConst(..) => {
|
||||
|
@ -24,7 +24,7 @@ mod test {
|
||||
mod bad {
|
||||
fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
|
||||
|
||||
static bad: isize = 1; //~ ERROR static constant `bad` should have an upper case name
|
||||
static bad: isize = 1; //~ ERROR static variable `bad` should have an upper case name
|
||||
}
|
||||
|
||||
mod warn {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#![forbid(non_upper_case_globals)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
static foo: isize = 1; //~ ERROR static constant `foo` should have an upper case name such as `FOO`
|
||||
static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name such as `FOO`
|
||||
|
||||
static mut bar: isize = 1;
|
||||
//~^ ERROR static variable `bar` should have an upper case name such as `BAR`
|
||||
|
Loading…
Reference in New Issue
Block a user