Use one message for uppercase global lint

This commit is contained in:
Aleksey Kladov 2016-10-17 11:10:34 +03:00
parent 72399f2db7
commit 066d62d4b4
3 changed files with 3 additions and 6 deletions

View File

@ -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(..) => {

View File

@ -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 {

View File

@ -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`