Do not uppercase-lint no_mangle statics

This commit is contained in:
varkor 2018-04-10 22:30:23 +01:00
parent 4b9b70c394
commit 6e0089ea77
2 changed files with 6 additions and 0 deletions

View File

@ -368,6 +368,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node {
hir::ItemStatic(..) => {
if attr::find_by_name(&it.attrs, "no_mangle").is_some() {
return;
}
NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span);
}
hir::ItemConst(..) => {

View File

@ -16,4 +16,7 @@ static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case
static mut bar: isize = 1;
//~^ ERROR static variable `bar` should have an upper case name such as `BAR`
#[no_mangle]
pub static extern_foo: isize = 1; // OK, because #[no_mangle] supersedes the warning
fn main() { }