From de7abd88244a9fe7033cb71e22af0601d1b811b9 Mon Sep 17 00:00:00 2001 From: P1start Date: Sat, 19 Jul 2014 00:45:17 +1200 Subject: [PATCH] Unify non-snake-case lints and non-uppercase statics lints This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change] --- src/doc/guide-ffi.md | 2 +- src/etc/unicode.py | 2 +- src/libcollections/hash/mod.rs | 1 + src/libcore/char.rs | 2 +- src/libcore/fmt/mod.rs | 2 +- src/libcore/str.rs | 54 +++--- src/liblibc/lib.rs | 4 +- src/libnative/io/mod.rs | 2 +- src/libnative/io/process.rs | 2 +- src/libnum/bigint.rs | 1 + src/librbml/lib.rs | 2 +- src/libregex/test/bench.rs | 2 +- src/librustc/diagnostics.rs | 2 + src/librustc/lint/builtin.rs | 176 +++++++++--------- src/librustc/lint/context.rs | 4 +- src/librustc/middle/trans/build.rs | 2 +- src/librustc/middle/trans/cabi_arm.rs | 2 +- src/librustc/middle/trans/cabi_mips.rs | 2 +- src/librustc/middle/trans/cabi_x86_64.rs | 2 +- src/librustc/middle/trans/common.rs | 2 +- src/librustc/middle/trans/debuginfo.rs | 4 +- src/librustc/middle/trans/intrinsic.rs | 2 +- src/librustc/middle/trans/type_.rs | 2 +- src/librustc/middle/ty.rs | 1 + src/librustc/util/nodemap.rs | 2 + src/librustc_llvm/lib.rs | 4 +- src/librustdoc/flock.rs | 2 +- src/librustrt/libunwind.rs | 2 +- src/librustrt/mutex.rs | 2 +- src/librustrt/thread.rs | 2 +- src/librustrt/thread_local_storage.rs | 2 +- src/libserialize/json.rs | 2 +- src/libserialize/serialize.rs | 4 +- src/libstd/dynamic_lib.rs | 2 +- src/libstd/os.rs | 2 +- src/libstd/rand/os.rs | 2 +- src/libstd/rt/backtrace.rs | 6 +- src/libsyntax/abi.rs | 2 +- src/libsyntax/ast.rs | 2 +- src/libterm/win.rs | 2 +- src/libunicode/tables.rs | 2 +- src/libunicode/u_char.rs | 8 +- src/test/bench/shootout-spectralnorm.rs | 2 +- src/test/bench/sudoku.rs | 2 +- .../compile-fail/lint-non-camel-case-types.rs | 2 + .../lint-non-snake-case-functions.rs | 2 +- .../lint-non-snake-case-lifetimes.rs | 18 ++ .../lint-non-snake-case-modules.rs | 20 ++ .../compile-fail/lint-uppercase-variables.rs | 10 +- .../compile-fail/match-static-const-lc.rs | 4 +- .../run-pass/match-static-const-rename.rs | 3 +- 51 files changed, 214 insertions(+), 176 deletions(-) create mode 100644 src/test/compile-fail/lint-non-snake-case-lifetimes.rs create mode 100644 src/test/compile-fail/lint-non-snake-case-modules.rs diff --git a/src/doc/guide-ffi.md b/src/doc/guide-ffi.md index 0ded9db3ad08b..294cae3a1f76b 100644 --- a/src/doc/guide-ffi.md +++ b/src/doc/guide-ffi.md @@ -477,7 +477,7 @@ extern crate libc; #[cfg(target_os = "win32", target_arch = "x86")] #[link(name = "kernel32")] -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] extern "stdcall" { fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int; } diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 7663cd1e3466a..a74bb74897135 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -34,7 +34,7 @@ // NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly -#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)] +#![allow(missing_doc, non_uppercase_statics, non_snake_case)] ''' # Mapping taken from Table 12 from: diff --git a/src/libcollections/hash/mod.rs b/src/libcollections/hash/mod.rs index 8d20208515cbc..a264acf5d03a3 100644 --- a/src/libcollections/hash/mod.rs +++ b/src/libcollections/hash/mod.rs @@ -159,6 +159,7 @@ macro_rules! impl_hash_tuple( impl),*> Hash for ($($name,)*) { #[allow(uppercase_variables)] #[inline] + #[allow(non_snake_case)] fn hash(&self, state: &mut S) { match *self { ($(ref $name,)*) => { diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 4e9a72c6af544..95267a8f9e5fa 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -12,7 +12,7 @@ //! //! For more details, see ::unicode::char (a.k.a. std::char) -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #![doc(primitive = "char")] use mem::transmute; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index f7ff92f5ce39b..32663e5eb0fe2 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -668,7 +668,7 @@ macro_rules! tuple ( () => (); ( $($name:ident,)+ ) => ( impl<$($name:Show),*> Show for ($($name,)*) { - #[allow(uppercase_variables, dead_assignment)] + #[allow(non_snake_case, dead_assignment)] fn fmt(&self, f: &mut Formatter) -> Result { try!(write!(f, "(")); let ($(ref $name,)*) = *self; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 5cbeda94d0f86..b067e6299ee2e 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -394,9 +394,9 @@ impl NaiveSearcher { fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(uint, uint)> { while self.position + needle.len() <= haystack.len() { if haystack.slice(self.position, self.position + needle.len()) == needle { - let matchPos = self.position; + let match_pos = self.position; self.position += needle.len(); // add 1 for all matches - return Some((matchPos, matchPos + needle.len())); + return Some((match_pos, match_pos + needle.len())); } else { self.position += 1; } @@ -410,7 +410,7 @@ impl NaiveSearcher { #[deriving(Clone)] struct TwoWaySearcher { // constants - critPos: uint, + crit_pos: uint, period: uint, byteset: u64, @@ -423,32 +423,31 @@ struct TwoWaySearcher { // Crochemore, M., Perrin, D., 1991, Two-way string-matching, Journal of the ACM 38(3):651-675. impl TwoWaySearcher { fn new(needle: &[u8]) -> TwoWaySearcher { - let (critPos1, period1) = TwoWaySearcher::maximal_suffix(needle, false); - let (critPos2, period2) = TwoWaySearcher::maximal_suffix(needle, true); + let (crit_pos1, period1) = TwoWaySearcher::maximal_suffix(needle, false); + let (crit_pos2, period2) = TwoWaySearcher::maximal_suffix(needle, true); - let critPos; + let crit_pos; let period; - if critPos1 > critPos2 { - critPos = critPos1; + if crit_pos1 > crit_pos2 { + crit_pos = crit_pos1; period = period1; } else { - critPos = critPos2; + crit_pos = crit_pos2; period = period2; } let byteset = needle.iter() .fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a); - - // The logic here (calculating critPos and period, the final if statement to see which + // The logic here (calculating crit_pos and period, the final if statement to see which // period to use for the TwoWaySearcher) is essentially an implementation of the // "small-period" function from the paper (p. 670) // - // In the paper they check whether `needle.slice_to(critPos)` is a suffix of - // `needle.slice(critPos, critPos + period)`, which is precisely what this does - if needle.slice_to(critPos) == needle.slice(period, period + critPos) { + // In the paper they check whether `needle.slice_to(crit_pos)` is a suffix of + // `needle.slice(crit_pos, crit_pos + period)`, which is precisely what this does + if needle.slice_to(crit_pos) == needle.slice(period, period + crit_pos) { TwoWaySearcher { - critPos: critPos, + crit_pos: crit_pos, period: period, byteset: byteset, @@ -457,8 +456,8 @@ impl TwoWaySearcher { } } else { TwoWaySearcher { - critPos: critPos, - period: cmp::max(critPos, needle.len() - critPos) + 1, + crit_pos: crit_pos, + period: cmp::max(crit_pos, needle.len() - crit_pos) + 1, byteset: byteset, position: 0, @@ -468,7 +467,7 @@ impl TwoWaySearcher { } #[inline] - fn next(&mut self, haystack: &[u8], needle: &[u8], longPeriod: bool) -> Option<(uint, uint)> { + fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> Option<(uint, uint)> { 'search: loop { // Check that we have room to search in if self.position + needle.len() > haystack.len() { @@ -484,11 +483,12 @@ impl TwoWaySearcher { } // See if the right part of the needle matches - let start = if longPeriod { self.critPos } else { cmp::max(self.critPos, self.memory) }; + let start = if long_period { self.crit_pos } + else { cmp::max(self.crit_pos, self.memory) }; for i in range(start, needle.len()) { if needle[i] != haystack[self.position + i] { - self.position += i - self.critPos + 1; - if !longPeriod { + self.position += i - self.crit_pos + 1; + if !long_period { self.memory = 0; } continue 'search; @@ -496,11 +496,11 @@ impl TwoWaySearcher { } // See if the left part of the needle matches - let start = if longPeriod { 0 } else { self.memory }; - for i in range(start, self.critPos).rev() { + let start = if long_period { 0 } else { self.memory }; + for i in range(start, self.crit_pos).rev() { if needle[i] != haystack[self.position + i] { self.position += self.period; - if !longPeriod { + if !long_period { self.memory = needle.len() - self.period; } continue 'search; @@ -508,12 +508,12 @@ impl TwoWaySearcher { } // We have found a match! - let matchPos = self.position; + let match_pos = self.position; self.position += needle.len(); // add self.period for all matches - if !longPeriod { + if !long_period { self.memory = 0; // set to needle.len() - self.period for all matches } - return Some((matchPos, matchPos + needle.len())); + return Some((match_pos, match_pos + needle.len())); } } diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 949dd08eaa343..b8a7ac019c35c 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -74,10 +74,10 @@ */ #![allow(non_camel_case_types)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #![allow(non_uppercase_statics)] #![allow(missing_doc)] -#![allow(uppercase_variables)] +#![allow(non_snake_case)] #[cfg(test)] extern crate std; #[cfg(test)] extern crate test; diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index 2dc6539b17806..276194feaf0e3 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -21,7 +21,7 @@ //! play. The only dependencies of these modules are the normal system libraries //! that you would find on the respective platform. -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] use libc::c_int; use libc; diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index b8ec0cd549611..0cc7158bb5d32 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -838,7 +838,7 @@ fn free_handle(_handle: *mut ()) { #[cfg(unix)] fn translate_status(status: c_int) -> rtio::ProcessExit { - #![allow(non_snake_case_functions)] + #![allow(non_snake_case)] #[cfg(target_os = "linux")] #[cfg(target_os = "android")] mod imp { diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index ba45d2b2e73ff..68cfe061121ea 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -78,6 +78,7 @@ pub type DoubleBigDigit = u64; pub static ZERO_BIG_DIGIT: BigDigit = 0; static ZERO_VEC: [BigDigit, ..1] = [ZERO_BIG_DIGIT]; +#[allow(non_snake_case)] pub mod BigDigit { use super::BigDigit; use super::DoubleBigDigit; diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index a05c877a6a6e1..aaa1cb85d8566 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -1132,7 +1132,7 @@ mod tests { #[cfg(test)] mod bench { - #![allow(non_snake_case_functions)] + #![allow(non_snake_case)] use test::Bencher; use super::reader; diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs index 4bd9d1a8666c0..aa85a68b5b509 100644 --- a/src/libregex/test/bench.rs +++ b/src/libregex/test/bench.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] use std::rand::{Rng, task_rng}; use stdtest::Bencher; diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 77e73c46c402c..0c9260bdc7d99 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(non_snake_case)] + register_diagnostic!(E0001, r##" This error suggests that the expression arm corresponding to the noted pattern will never be reached as for all possible values of the expression being matched, diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 01fea98dfa076..71e966d77867e 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -737,19 +737,15 @@ impl LintPass for UnusedResult { } declare_lint!(NON_CAMEL_CASE_TYPES, Warn, - "types, variants and traits should have camel case names") + "types, variants, traits and type parameters should have camel case names") pub struct NonCamelCaseTypes; -impl LintPass for NonCamelCaseTypes { - fn get_lints(&self) -> LintArray { - lint_array!(NON_CAMEL_CASE_TYPES) - } - - fn check_item(&mut self, cx: &Context, it: &ast::Item) { +impl NonCamelCaseTypes { + fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) { fn is_camel_case(ident: ast::Ident) -> bool { let ident = token::get_ident(ident); - assert!(!ident.get().is_empty()); + if ident.get().is_empty() { return true; } let ident = ident.get().trim_chars('_'); // start with a non-lowercase letter rather than non-uppercase @@ -764,20 +760,26 @@ impl LintPass for NonCamelCaseTypes { )).collect() } - fn check_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) { - let s = token::get_ident(ident); + let s = token::get_ident(ident); - if !is_camel_case(ident) { - let c = to_camel_case(s.get()); - let m = if c.is_empty() { - format!("{} `{}` should have a camel case name such as `CamelCase`", sort, s) - } else { - format!("{} `{}` should have a camel case name such as `{}`", sort, s, c) - }; - cx.span_lint(NON_CAMEL_CASE_TYPES, span, m.as_slice()); - } + if !is_camel_case(ident) { + let c = to_camel_case(s.get()); + let m = if c.is_empty() { + format!("{} `{}` should have a camel case name such as `CamelCase`", sort, s) + } else { + format!("{} `{}` should have a camel case name such as `{}`", sort, s, c) + }; + cx.span_lint(NON_CAMEL_CASE_TYPES, span, m.as_slice()); } + } +} + +impl LintPass for NonCamelCaseTypes { + fn get_lints(&self) -> LintArray { + lint_array!(NON_CAMEL_CASE_TYPES) + } + fn check_item(&mut self, cx: &Context, it: &ast::Item) { let has_extern_repr = it.attrs.iter().map(|attr| { attr::find_repr_attrs(cx.tcx.sess.diagnostic(), attr).iter() .any(|r| r == &attr::ReprExtern) @@ -786,21 +788,27 @@ impl LintPass for NonCamelCaseTypes { match it.node { ast::ItemTy(..) | ast::ItemStruct(..) => { - check_case(cx, "type", it.ident, it.span) + self.check_case(cx, "type", it.ident, it.span) } ast::ItemTrait(..) => { - check_case(cx, "trait", it.ident, it.span) + self.check_case(cx, "trait", it.ident, it.span) } ast::ItemEnum(ref enum_definition, _) => { if has_extern_repr { return } - check_case(cx, "type", it.ident, it.span); + self.check_case(cx, "type", it.ident, it.span); for variant in enum_definition.variants.iter() { - check_case(cx, "variant", variant.node.name, variant.span); + self.check_case(cx, "variant", variant.node.name, variant.span); } } _ => () } } + + fn check_generics(&mut self, cx: &Context, it: &ast::Generics) { + for gen in it.ty_params.iter() { + self.check_case(cx, "type parameter", gen.ident, gen.span); + } + } } #[deriving(PartialEq)] @@ -836,17 +844,18 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext { } } -declare_lint!(NON_SNAKE_CASE_FUNCTIONS, Warn, - "methods and functions should have snake case names") +declare_lint!(NON_SNAKE_CASE, Warn, + "methods, functions, lifetime parameters and modules should have snake case names") -pub struct NonSnakeCaseFunctions; +pub struct NonSnakeCase; -impl NonSnakeCaseFunctions { +impl NonSnakeCase { fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) { fn is_snake_case(ident: ast::Ident) -> bool { let ident = token::get_ident(ident); - assert!(!ident.get().is_empty()); - let ident = ident.get().trim_chars('_'); + if ident.get().is_empty() { return true; } + let ident = ident.get().trim_left_chars('\''); + let ident = ident.trim_chars('_'); let mut allow_underscore = true; ident.chars().all(|c| { @@ -865,7 +874,7 @@ impl NonSnakeCaseFunctions { let mut buf = String::new(); if s.is_empty() { continue; } for ch in s.chars() { - if !buf.is_empty() && ch.is_uppercase() { + if !buf.is_empty() && buf.as_slice() != "'" && ch.is_uppercase() { words.push(buf); buf = String::new(); } @@ -879,16 +888,16 @@ impl NonSnakeCaseFunctions { let s = token::get_ident(ident); if !is_snake_case(ident) { - cx.span_lint(NON_SNAKE_CASE_FUNCTIONS, span, + cx.span_lint(NON_SNAKE_CASE, span, format!("{} `{}` should have a snake case name such as `{}`", sort, s, to_snake_case(s.get())).as_slice()); } } } -impl LintPass for NonSnakeCaseFunctions { +impl LintPass for NonSnakeCase { fn get_lints(&self) -> LintArray { - lint_array!(NON_SNAKE_CASE_FUNCTIONS) + lint_array!(NON_SNAKE_CASE) } fn check_fn(&mut self, cx: &Context, @@ -908,9 +917,49 @@ impl LintPass for NonSnakeCaseFunctions { } } + fn check_item(&mut self, cx: &Context, it: &ast::Item) { + match it.node { + ast::ItemMod(_) => { + self.check_snake_case(cx, "module", it.ident, it.span); + } + _ => {} + } + } + fn check_ty_method(&mut self, cx: &Context, t: &ast::TypeMethod) { self.check_snake_case(cx, "trait method", t.ident, t.span); } + + fn check_lifetime_decl(&mut self, cx: &Context, t: &ast::Lifetime) { + self.check_snake_case(cx, "lifetime", t.name.ident(), t.span); + } + + fn check_pat(&mut self, cx: &Context, p: &ast::Pat) { + match &p.node { + &ast::PatIdent(_, ref path1, _) => { + match cx.tcx.def_map.borrow().find(&p.id) { + Some(&def::DefLocal(_, _)) | Some(&def::DefBinding(_, _)) | + Some(&def::DefArg(_, _)) => { + self.check_snake_case(cx, "variable", path1.node, p.span); + } + _ => {} + } + } + _ => {} + } + } + + fn check_struct_def(&mut self, cx: &Context, s: &ast::StructDef, + _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { + for sf in s.fields.iter() { + match sf.node { + ast::StructField_ { kind: ast::NamedField(ident, _), .. } => { + self.check_snake_case(cx, "structure field", ident, sf.span); + } + _ => {} + } + } + } } declare_lint!(NON_UPPERCASE_STATICS, Allow, @@ -942,17 +991,6 @@ impl LintPass for NonUppercaseStatics { _ => {} } } -} - -declare_lint!(NON_UPPERCASE_PATTERN_STATICS, Warn, - "static constants in match patterns should be all caps") - -pub struct NonUppercasePatternStatics; - -impl LintPass for NonUppercasePatternStatics { - fn get_lints(&self) -> LintArray { - lint_array!(NON_UPPERCASE_PATTERN_STATICS) - } fn check_pat(&mut self, cx: &Context, p: &ast::Pat) { // Lint for constants that look like binding identifiers (#7526) @@ -960,7 +998,7 @@ impl LintPass for NonUppercasePatternStatics { (&ast::PatIdent(_, ref path1, _), Some(&def::DefStatic(_, false))) => { let s = token::get_ident(path1.node); if s.get().chars().any(|c| c.is_lowercase()) { - cx.span_lint(NON_UPPERCASE_PATTERN_STATICS, path1.span, + cx.span_lint(NON_UPPERCASE_STATICS, path1.span, format!("static constant in pattern `{}` should have an uppercase \ name such as `{}`", s.get(), s.get().chars().map(|c| c.to_uppercase()) @@ -972,54 +1010,6 @@ impl LintPass for NonUppercasePatternStatics { } } -declare_lint!(UPPERCASE_VARIABLES, Warn, - "variable and structure field names should start with a lowercase character") - -pub struct UppercaseVariables; - -impl LintPass for UppercaseVariables { - fn get_lints(&self) -> LintArray { - lint_array!(UPPERCASE_VARIABLES) - } - - fn check_pat(&mut self, cx: &Context, p: &ast::Pat) { - match &p.node { - &ast::PatIdent(_, ref path1, _) => { - match cx.tcx.def_map.borrow().find(&p.id) { - Some(&def::DefLocal(_, _)) | Some(&def::DefBinding(_, _)) | - Some(&def::DefArg(_, _)) => { - let s = token::get_ident(path1.node); - if s.get().len() > 0 && s.get().char_at(0).is_uppercase() { - cx.span_lint(UPPERCASE_VARIABLES, path1.span, - "variable names should start with \ - a lowercase character"); - } - } - _ => {} - } - } - _ => {} - } - } - - fn check_struct_def(&mut self, cx: &Context, s: &ast::StructDef, - _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { - for sf in s.fields.iter() { - match sf.node { - ast::StructField_ { kind: ast::NamedField(ident, _), .. } => { - let s = token::get_ident(ident); - if s.get().char_at(0).is_uppercase() { - cx.span_lint(UPPERCASE_VARIABLES, sf.span, - "structure field names should start with \ - a lowercase character"); - } - } - _ => {} - } - } - } -} - declare_lint!(UNNECESSARY_PARENS, Warn, "`if`, `match`, `while` and `return` do not need parentheses") diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 8952e565008e8..28e4e1a564ef9 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -146,10 +146,8 @@ impl LintStore { PathStatement, UnusedResult, NonCamelCaseTypes, - NonSnakeCaseFunctions, + NonSnakeCase, NonUppercaseStatics, - NonUppercasePatternStatics, - UppercaseVariables, UnnecessaryParens, UnusedUnsafe, UnsafeBlock, diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index d2ddf3ff69662..76059e8df4f8c 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(dead_code)] // FFI wrappers -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] use llvm; use llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect, AttrBuilder}; diff --git a/src/librustc/middle/trans/cabi_arm.rs b/src/librustc/middle/trans/cabi_arm.rs index 0e2bf2104fd55..ccfc79ac0c500 100644 --- a/src/librustc/middle/trans/cabi_arm.rs +++ b/src/librustc/middle/trans/cabi_arm.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] use llvm; use llvm::{Integer, Pointer, Float, Double, Struct, Array}; diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs index ac4c56a1d1f11..77815285428fd 100644 --- a/src/librustc/middle/trans/cabi_mips.rs +++ b/src/librustc/middle/trans/cabi_mips.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] use libc::c_uint; use std::cmp; diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 2ab4814fa0cc3..0d4cb637ae0cd 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -11,7 +11,7 @@ // The classification code for the x86_64 ABI is taken from the clay language // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] use llvm; use llvm::{Integer, Pointer, Float, Double}; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 05528d2b3d88e..d92364b257010 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_camel_case_types, non_snake_case_functions)] +#![allow(non_camel_case_types, non_snake_case)] //! Code that is useful in various trans modules. diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 26973910400ee..bd337c4b934af 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -1447,7 +1447,7 @@ fn is_node_local_to_unit(cx: &CrateContext, node_id: ast::NodeId) -> bool !cx.reachable.contains(&node_id) } -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] fn create_DIArray(builder: DIBuilderRef, arr: &[DIDescriptor]) -> DIArray { return unsafe { llvm::LLVMDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32) @@ -3107,7 +3107,7 @@ fn debug_context<'a>(cx: &'a CrateContext) -> &'a CrateDebugContext { } #[inline] -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] fn DIB(cx: &CrateContext) -> DIBuilderRef { cx.dbg_cx.get_ref().builder } diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index 7d8e4679ae302..3c61708fb7b83 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] use llvm; use llvm::{SequentiallyConsistent, Acquire, Release, Xchg, ValueRef}; diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index 017d61137e4b0..7b98d65a3105b 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] use llvm; use llvm::{TypeRef, Bool, False, True, TypeKind, ValueRef}; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 6f2dd6e099235..051ddd572416e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2118,6 +2118,7 @@ pub struct TypeContents { macro_rules! def_type_content_sets( (mod $mname:ident { $($name:ident = $bits:expr),+ }) => { + #[allow(non_snake_case)] mod $mname { use middle::ty::TypeContents; $(pub static $name: TypeContents = TypeContents { bits: $bits };)+ diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index 34a2faa581c5e..a38ee84e95dfb 100644 --- a/src/librustc/util/nodemap.rs +++ b/src/librustc/util/nodemap.rs @@ -10,6 +10,8 @@ //! An efficient hash map for node IDs +#![allow(non_snake_case)] + use std::collections::{HashMap, HashSet}; use std::hash::{Hasher, Hash, Writer}; use syntax::ast; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 522941cee8c9d..7d2d25097a8f8 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_uppercase_pattern_statics)] +#![allow(non_uppercase_statics)] #![allow(non_camel_case_types)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #![allow(dead_code)] #![crate_name = "rustc_llvm"] diff --git a/src/librustdoc/flock.rs b/src/librustdoc/flock.rs index cb8be9c899757..101f1c7460571 100644 --- a/src/librustdoc/flock.rs +++ b/src/librustdoc/flock.rs @@ -162,7 +162,7 @@ mod imp { static LOCKFILE_EXCLUSIVE_LOCK: libc::DWORD = 0x00000002; - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn LockFileEx(hFile: libc::HANDLE, dwFlags: libc::DWORD, diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs index a43920d27a763..69df8a7fd66e3 100644 --- a/src/librustrt/libunwind.rs +++ b/src/librustrt/libunwind.rs @@ -11,7 +11,7 @@ //! Unwind library interface #![allow(non_camel_case_types)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #![allow(dead_code)] // these are just bindings use libc; diff --git a/src/librustrt/mutex.rs b/src/librustrt/mutex.rs index 08da9b8aad1b0..3aa798aa92a20 100644 --- a/src/librustrt/mutex.rs +++ b/src/librustrt/mutex.rs @@ -629,7 +629,7 @@ mod imp { libc::CloseHandle(block); } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn CreateEventA(lpSecurityAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, diff --git a/src/librustrt/thread.rs b/src/librustrt/thread.rs index 1f0b0c7c207bf..6d18ec4f9f5ad 100644 --- a/src/librustrt/thread.rs +++ b/src/librustrt/thread.rs @@ -198,7 +198,7 @@ mod imp { SwitchToThread(); } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn CreateThread(lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, diff --git a/src/librustrt/thread_local_storage.rs b/src/librustrt/thread_local_storage.rs index b9b12686170c0..6078ed990e41d 100644 --- a/src/librustrt/thread_local_storage.rs +++ b/src/librustrt/thread_local_storage.rs @@ -83,7 +83,7 @@ pub unsafe fn destroy(key: Key) { } #[cfg(windows)] -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] extern "system" { fn TlsAlloc() -> DWORD; fn TlsFree(dwTlsIndex: DWORD) -> BOOL; diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index d70b6b4d57bb8..b37b4588af630 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2282,7 +2282,7 @@ macro_rules! tuple_impl { > ToJson for ( $( $tyvar ),* , ) { #[inline] - #[allow(uppercase_variables)] + #[allow(non_snake_case)] fn to_json(&self) -> Json { match *self { ($(ref $tyvar),*,) => List(vec![$($tyvar.to_json()),*]) diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index bbaac7a96e9ee..2cda00ad6c4af 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -481,7 +481,7 @@ macro_rules! tuple ( () => (); ( $($name:ident,)+ ) => ( impl,$($name:Decodable),*> Decodable for ($($name,)*) { - #[allow(uppercase_variables)] + #[allow(non_snake_case)] fn decode(d: &mut D) -> Result<($($name,)*), E> { d.read_tuple(|d, amt| { let mut i = 0; @@ -496,7 +496,7 @@ macro_rules! tuple ( } } impl,$($name:Encodable),*> Encodable for ($($name,)*) { - #[allow(uppercase_variables)] + #[allow(non_snake_case)] fn encode(&self, s: &mut S) -> Result<(), E> { let ($(ref $name,)*) = *self; let mut n = 0; diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 16c00d76c5465..eee3e81f5fc06 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -328,7 +328,7 @@ pub mod dl { FreeLibrary(handle as *mut libc::c_void); () } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn SetLastError(error: libc::size_t); fn LoadLibraryW(name: *const libc::c_void) -> *mut libc::c_void; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index f452f8b23e7ba..ea278d55db956 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -29,7 +29,7 @@ #![experimental] #![allow(missing_doc)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] use clone::Clone; use collections::{Collection, MutableSeq}; diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 07ad08e1b3c03..95be3191bab49 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -161,7 +161,7 @@ mod imp { static CRYPT_VERIFYCONTEXT: DWORD = 0xF0000000; static NTE_BAD_SIGNATURE: DWORD = 0x80090006; - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn CryptAcquireContextA(phProv: *mut HCRYPTPROV, pszContainer: LPCSTR, diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 58b3179a297ce..aadc9178e1a00 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -543,7 +543,7 @@ mod imp { /// iOS doesn't use all of them it but adding more /// platform-specific configs pollutes the code too much #[allow(non_camel_case_types)] - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[allow(dead_code)] mod uw { use libc; @@ -657,7 +657,7 @@ mod imp { /// copy of that function in my mingw install (maybe it was broken?). Instead, /// this takes the route of using StackWalk64 in order to walk the stack. #[cfg(windows)] -#[allow(dead_code, uppercase_variables)] +#[allow(dead_code, non_snake_case)] mod imp { use c_str::CString; use core_collections::Collection; @@ -674,7 +674,7 @@ mod imp { use str::StrSlice; use dynamic_lib::DynamicLibrary; - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] extern "system" { fn GetCurrentProcess() -> libc::HANDLE; fn GetCurrentThread() -> libc::HANDLE; diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 3280829f95835..6d9b8821bd890 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -157,7 +157,7 @@ impl fmt::Show for Os { } } -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] #[test] fn lookup_Rust() { let abi = lookup("Rust"); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index d574a02fded22..8df6b65cd1654 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -29,7 +29,7 @@ use serialize::{Encodable, Decodable, Encoder, Decoder}; // FIXME(eddyb) #10676 use Rc in the future. pub type P = Gc; -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] /// Construct a P from a T value. pub fn P(value: T) -> P { box(GC) value diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 64a61cc6b3bdc..cd61f9bb35ed1 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -27,7 +27,7 @@ pub struct WinConsole { background: color::Color, } -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] #[link(name = "kernel32")] extern "system" { fn SetConsoleTextAttribute(handle: libc::HANDLE, attr: libc::WORD) -> libc::BOOL; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index d6010cd8d7bfb..135b267262cc6 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -10,7 +10,7 @@ // NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly -#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)] +#![allow(missing_doc, non_uppercase_statics, non_snake_case)] fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use core::cmp::{Equal, Less, Greater}; diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index 0f75cf86c18da..91e7589b8caeb 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -33,7 +33,7 @@ pub fn is_alphabetic(c: char) -> bool { /// 'XID_Start' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to ID_Start but modified for closure under NFKx. -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) } /// Returns whether the specified `char` satisfies the 'XID_Continue' Unicode property @@ -41,7 +41,7 @@ pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) } /// 'XID_Continue' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to 'ID_Continue' but modified for closure under NFKx. -#[allow(non_snake_case_functions)] +#[allow(non_snake_case)] pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) } /// @@ -174,7 +174,7 @@ pub trait UnicodeChar { /// 'XID_Start' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to ID_Start but modified for closure under NFKx. - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] fn is_XID_start(&self) -> bool; /// Returns whether the specified `char` satisfies the 'XID_Continue' @@ -183,7 +183,7 @@ pub trait UnicodeChar { /// 'XID_Continue' is a Unicode Derived Property specified in /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), /// mostly similar to 'ID_Continue' but modified for closure under NFKx. - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] fn is_XID_continue(&self) -> bool; diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index 2cbbfdb23fe02..49c1233484476 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -11,7 +11,7 @@ // no-pretty-expanded FIXME #15189 #![feature(phase)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #[phase(plugin)] extern crate green; use std::from_str::FromStr; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 7129d4993b74f..728f6bd043a26 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -10,7 +10,7 @@ // ignore-pretty very bad with line comments -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] use std::io; use std::io::stdio::StdReader; diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/compile-fail/lint-non-camel-case-types.rs index f33c7956a1418..6ce63e2ecdb77 100644 --- a/src/test/compile-fail/lint-non-camel-case-types.rs +++ b/src/test/compile-fail/lint-non-camel-case-types.rs @@ -32,6 +32,8 @@ enum Foo5 { trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6` } +fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty` + #[repr(C)] struct foo7 { bar: int, diff --git a/src/test/compile-fail/lint-non-snake-case-functions.rs b/src/test/compile-fail/lint-non-snake-case-functions.rs index 4253286996c5a..ccbe1f006e308 100644 --- a/src/test/compile-fail/lint-non-snake-case-functions.rs +++ b/src/test/compile-fail/lint-non-snake-case-functions.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(non_snake_case_functions)] +#![deny(non_snake_case)] #![allow(dead_code)] struct Foo; diff --git a/src/test/compile-fail/lint-non-snake-case-lifetimes.rs b/src/test/compile-fail/lint-non-snake-case-lifetimes.rs new file mode 100644 index 0000000000000..64669d90d06bf --- /dev/null +++ b/src/test/compile-fail/lint-non-snake-case-lifetimes.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(non_snake_case)] +#![allow(dead_code)] + +fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name such as `'foo_bar` + _: &'FooBar () +) {} + +fn main() { } diff --git a/src/test/compile-fail/lint-non-snake-case-modules.rs b/src/test/compile-fail/lint-non-snake-case-modules.rs new file mode 100644 index 0000000000000..5bc84698ec905 --- /dev/null +++ b/src/test/compile-fail/lint-non-snake-case-modules.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(non_snake_case)] +#![allow(dead_code)] + +mod FooBar { //~ ERROR module `FooBar` should have a snake case name such as `foo_bar` + pub struct S; +} + +fn f(_: FooBar::S) { } + +fn main() { } diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs index 279cf6d94cbf1..902cd63b1e78c 100644 --- a/src/test/compile-fail/lint-uppercase-variables.rs +++ b/src/test/compile-fail/lint-uppercase-variables.rs @@ -11,21 +11,21 @@ // ignore-tidy-linelength #![allow(dead_code)] -#![deny(uppercase_variables)] +#![deny(non_snake_case)] use std::io::File; use std::io::IoError; struct Something { - X: uint //~ ERROR structure field names should start with a lowercase character + X: uint //~ ERROR structure field `X` should have a snake case name such as `x` } -fn test(Xx: uint) { //~ ERROR variable names should start with a lowercase character +fn test(Xx: uint) { //~ ERROR variable `Xx` should have a snake case name such as `xx` println!("{}", Xx); } fn main() { - let Test: uint = 0; //~ ERROR variable names should start with a lowercase character + let Test: uint = 0; //~ ERROR variable `Test` should have a snake case name such as `test` println!("{}", Test); let mut f = File::open(&Path::new("something.txt")); @@ -33,7 +33,7 @@ fn main() { match f.read(buff) { Ok(cnt) => println!("read this many bytes: {}", cnt), Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()), - //~^ ERROR variable names should start with a lowercase character + //~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file` } test(1); diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/compile-fail/match-static-const-lc.rs index b5ffa3546c19d..a5dce6ecc6f3e 100644 --- a/src/test/compile-fail/match-static-const-lc.rs +++ b/src/test/compile-fail/match-static-const-lc.rs @@ -11,8 +11,9 @@ // Issue #7526: lowercase static constants in patterns look like bindings #![allow(dead_code)] -#![deny(non_uppercase_pattern_statics)] +#![deny(non_uppercase_statics)] +#[allow(non_uppercase_statics)] pub static a : int = 97; fn f() { @@ -25,6 +26,7 @@ fn f() { } mod m { + #[allow(non_uppercase_statics)] pub static aha : int = 7; } diff --git a/src/test/run-pass/match-static-const-rename.rs b/src/test/run-pass/match-static-const-rename.rs index 92f57f34c947d..9028e68da1fd9 100644 --- a/src/test/run-pass/match-static-const-rename.rs +++ b/src/test/run-pass/match-static-const-rename.rs @@ -16,7 +16,7 @@ // around this problem locally by renaming the constant in the `use` // form to an uppercase identifier that placates the lint. -#![deny(non_uppercase_pattern_statics)] +#![deny(non_uppercase_statics)] pub static A : int = 97; @@ -34,6 +34,7 @@ fn f() { } mod m { + #[allow(non_uppercase_statics)] pub static aha : int = 7; }