]> git.lizzy.rs Git - rust.git/commitdiff
Unify non-snake-case lints and non-uppercase statics lints
authorP1start <rewi-github@whanau.org>
Fri, 18 Jul 2014 12:45:17 +0000 (00:45 +1200)
committerP1start <rewi-github@whanau.org>
Fri, 29 Aug 2014 21:10:05 +0000 (09:10 +1200)
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]

51 files changed:
src/doc/guide-ffi.md
src/etc/unicode.py
src/libcollections/hash/mod.rs
src/libcore/char.rs
src/libcore/fmt/mod.rs
src/libcore/str.rs
src/liblibc/lib.rs
src/libnative/io/mod.rs
src/libnative/io/process.rs
src/libnum/bigint.rs
src/librbml/lib.rs
src/libregex/test/bench.rs
src/librustc/diagnostics.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/cabi_arm.rs
src/librustc/middle/trans/cabi_mips.rs
src/librustc/middle/trans/cabi_x86_64.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/type_.rs
src/librustc/middle/ty.rs
src/librustc/util/nodemap.rs
src/librustc_llvm/lib.rs
src/librustdoc/flock.rs
src/librustrt/libunwind.rs
src/librustrt/mutex.rs
src/librustrt/thread.rs
src/librustrt/thread_local_storage.rs
src/libserialize/json.rs
src/libserialize/serialize.rs
src/libstd/dynamic_lib.rs
src/libstd/os.rs
src/libstd/rand/os.rs
src/libstd/rt/backtrace.rs
src/libsyntax/abi.rs
src/libsyntax/ast.rs
src/libterm/win.rs
src/libunicode/tables.rs
src/libunicode/u_char.rs
src/test/bench/shootout-spectralnorm.rs
src/test/bench/sudoku.rs
src/test/compile-fail/lint-non-camel-case-types.rs
src/test/compile-fail/lint-non-snake-case-functions.rs
src/test/compile-fail/lint-non-snake-case-lifetimes.rs [new file with mode: 0644]
src/test/compile-fail/lint-non-snake-case-modules.rs [new file with mode: 0644]
src/test/compile-fail/lint-uppercase-variables.rs
src/test/compile-fail/match-static-const-lc.rs
src/test/run-pass/match-static-const-rename.rs

index 0ded9db3ad08b4aea9c0c81951c4e1068f5e9548..294cae3a1f76b1bec74c47741a1160e485e4058a 100644 (file)
@@ -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;
 }
index 7663cd1e3466abb3d0bfb1ff5d67d455e8aa86f7..a74bb748971356a24de6de0122245d7712b09242 100755 (executable)
@@ -34,7 +34,7 @@ preamble = '''// Copyright 2012-2014 The Rust Project Developers. See the COPYRI
 
 // 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:
index 8d20208515cbce4e9bf79c56853020b153325b36..a264acf5d03a3059dedf0e1a98a274f8b843826d 100644 (file)
@@ -159,6 +159,7 @@ fn hash(&self, state: &mut S) {
         impl<S: Writer, $($name: Hash<S>),*> Hash<S> for ($($name,)*) {
             #[allow(uppercase_variables)]
             #[inline]
+            #[allow(non_snake_case)]
             fn hash(&self, state: &mut S) {
                 match *self {
                     ($(ref $name,)*) => {
index 4e9a72c6af544c95974646b77c9420bdae10640c..95267a8f9e5fab92d78e9b4a54a29c50678bd0f5 100644 (file)
@@ -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;
index f7ff92f5ce39bc669225d9e1c02e4407666bb8b9..32663e5eb0fe2b6c9bb4cca88f1213be9b4fe606 100644 (file)
@@ -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;
index 5cbeda94d0f8607d95c8c48300c0636ebb99d2d7..b067e6299ee2e0a6c29fd2c803ea9cdb60d55004 100644 (file)
@@ -394,9 +394,9 @@ fn new() -> 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 @@ fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(uint, uint)> {
 #[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 @@ fn new(needle: &[u8]) -> 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 @@ fn new(needle: &[u8]) -> 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 @@ fn next(&mut self, haystack: &[u8], needle: &[u8], longPeriod: bool) -> Option<(
             }
 
             // 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 @@ fn next(&mut self, haystack: &[u8], needle: &[u8], longPeriod: bool) -> Option<(
             }
 
             // 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 @@ fn next(&mut self, haystack: &[u8], needle: &[u8], longPeriod: bool) -> Option<(
             }
 
             // 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()));
         }
     }
 
index 949dd08eaa343cc098db121f0f9aae587bea5f56..b8a7ac019c35c4507b812bfedde914ae4e728213 100644 (file)
 */
 
 #![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;
index 2dc6539b1780620b904ea408c3a6194a4268bd73..276194feaf0e39ce0a2de99a610ed7828ec50f77 100644 (file)
@@ -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;
index b8ec0cd549611dd59758d7e7b8d8de012ad4aee5..0cc7158bb5d32c9d28ecdeeb0570f6ead1cbf30a 100644 (file)
@@ -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 {
index ba45d2b2e73ff2c569dc240c3b97a96ad41b1907..68cfe061121eab064daec80244deae6ae448f1c8 100644 (file)
@@ -78,6 +78,7 @@
 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;
index a05c877a6a6e10e10df2de96a239dddec6b049c7..aaa1cb85d8566afa3566beafb6fdd94fee636679 100644 (file)
@@ -1132,7 +1132,7 @@ fn test_v(v: Option<int>) {
 
 #[cfg(test)]
 mod bench {
-    #![allow(non_snake_case_functions)]
+    #![allow(non_snake_case)]
     use test::Bencher;
     use super::reader;
 
index 4bd9d1a8666c0949f28707294c4b28bf01c8a25e..aa85a68b5b50990d486f8038a2bc6bd448511886 100644 (file)
@@ -7,7 +7,7 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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;
index 77e73c46c402cf2f6ac23962b2dc4d80124759be..0c9260bdc7d99c7d172bfb4a0580d00a4eb68e2a 100644 (file)
@@ -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,
index 01fea98dfa0768546cc5a74f07000da3508bb394..71e966d77867e31279ae046d854d3e29277137e3 100644 (file)
@@ -737,19 +737,15 @@ fn check_must_use(cx: &Context, attrs: &[ast::Attribute], sp: Span) -> bool {
 }
 
 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 @@ fn to_camel_case(s: &str) -> String {
             )).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 @@ fn check_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
 
         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 @@ fn to_snake_case(str: &str) -> String {
                 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 @@ fn to_snake_case(str: &str) -> String {
         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 @@ fn check_fn(&mut self, cx: &Context,
         }
     }
 
+    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 @@ fn check_item(&mut self, cx: &Context, it: &ast::Item) {
             _ => {}
         }
     }
-}
-
-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 @@ fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
             (&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 @@ fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
     }
 }
 
-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")
 
index 8952e565008e8fd5d9b60780db664b2bb19dc665..28e4e1a564ef9b707fb55027c5009e1cef0f092f 100644 (file)
@@ -146,10 +146,8 @@ macro_rules! add_builtin_with_new ( ( $sess:ident, $($name:ident),*, ) => (
                      PathStatement,
                      UnusedResult,
                      NonCamelCaseTypes,
-                     NonSnakeCaseFunctions,
+                     NonSnakeCase,
                      NonUppercaseStatics,
-                     NonUppercasePatternStatics,
-                     UppercaseVariables,
                      UnnecessaryParens,
                      UnusedUnsafe,
                      UnsafeBlock,
index d2ddf3ff696627c76e1ded2d0da9d31b8b55b6e0..76059e8df4f8cd046fdf81faa566608ef6b9e9e3 100644 (file)
@@ -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};
index 0e2bf2104fd55923bb61f002e59b03e855261489..ccfc79ac0c5002bec9ce1074297c366250d6df6f 100644 (file)
@@ -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};
index ac4c56a1d1f11669a2df8dca07b664f2d42c72c5..77815285428fdb3a5cd3954be758b2a3a7c1f22f 100644 (file)
@@ -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;
index 2ab4814fa0cc3c633e3a2a579d6efc37ca9c0bc6..0d4cb637ae0cd7b95bb4f55e8476752405ca16dc 100644 (file)
@@ -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};
index 05528d2b3d88e60876ff07de8f1d48cbe06e05bc..d92364b2570108ab9e2cccfc373c9ee59c6c8c53 100644 (file)
@@ -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.
 
index 26973910400ee1f0a60ccaebc75413d56a0580fe..bd337c4b934af4cd3fb74ec3a80ed1d68c7e714e 100644 (file)
@@ -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
 }
index 7d8e4679ae302d2ff4f3e412c93d92a89dfc9c82..3c61708fb7b83ac89368c918d01af2018cf4941c 100644 (file)
@@ -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};
index 017d61137e4b0d0bcbcb59e79facd5071301613e..7b98d65a3105b88a5b1f06e3c0bcb0f2492b90ce 100644 (file)
@@ -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};
index 6f2dd6e099235ebe290814c5c8c9aabc737d4b19..051ddd572416ea0687ce12c3f1431b9cf5909d49 100644 (file)
@@ -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 };)+
index 34a2faa581c5ec28400f814d5987712fd680109c..a38ee84e95dfb9cf7418d0a9fefd1f89919dc1d5 100644 (file)
@@ -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;
index 522941cee8c9d877940527c30491c75cf2a35dd5..7d2d25097a8f83cce9f1a4cccd0aeec542add9bb 100644 (file)
@@ -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"]
index cb8be9c899757d4c24a97f6cc3393100c34cba5a..101f1c7460571b63ccf4724aa00357afc3c169ca 100644 (file)
@@ -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,
index a43920d27a763115e0b9203dcb2ae6572945c5d8..69df8a7fd66e316f696068313972d952246c1c5f 100644 (file)
@@ -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;
index 08da9b8aad1b01424236bd4ddbee55c0ec2c2b71..3aa798aa92a2075e81821e0aefa6bb7b1018234b 100644 (file)
@@ -629,7 +629,7 @@ pub unsafe fn free_cond(h: uint) {
         libc::CloseHandle(block);
     }
 
-    #[allow(non_snake_case_functions)]
+    #[allow(non_snake_case)]
     extern "system" {
         fn CreateEventA(lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
                         bManualReset: BOOL,
index 1f0b0c7c207bfbb540ee66d7bf256f902531304d..6d18ec4f9f5ad81035dc8b103f5441e7a5317ccf 100644 (file)
@@ -198,7 +198,7 @@ pub unsafe fn yield_now() {
         SwitchToThread();
     }
 
-    #[allow(non_snake_case_functions)]
+    #[allow(non_snake_case)]
     extern "system" {
         fn CreateThread(lpThreadAttributes: LPSECURITY_ATTRIBUTES,
                         dwStackSize: SIZE_T,
index b9b12686170c0eacb01d2672be93bf231079b57b..6078ed990e41d6dd25c5f56dca10199874b1ddc2 100644 (file)
@@ -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;
index d70b6b4d57bb8367eaff7cbec19a08a35edaa7a4..b37b4588af6307c14c510634f06654bb1aad4405 100644 (file)
@@ -2282,7 +2282,7 @@ 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()),*])
index bbaac7a96e9ee5df9dd3e33f3594e5aaffd89dd8..2cda00ad6c4af452719d01c423bb0191b4437547 100644 (file)
@@ -481,7 +481,7 @@ macro_rules! tuple (
     () => ();
     ( $($name:ident,)+ ) => (
         impl<E, D:Decoder<E>,$($name:Decodable<D, E>),*> Decodable<D,E> 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 @@ fn decode(d: &mut D) -> Result<($($name,)*), E> {
             }
         }
         impl<E, S:Encoder<E>,$($name:Encodable<S, E>),*> Encodable<S, E> 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;
index 16c00d76c54655957413db569a200e899d0899d7..eee3e81f5fc062c8c710d61d479ed682c254f1a6 100644 (file)
@@ -328,7 +328,7 @@ pub unsafe fn close(handle: *mut u8) {
         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;
index f452f8b23e7bac5fa37c4abbb5fd9a08a1a73658..ea278d55db956fcee2e15c49bada2d454aa83ceb 100644 (file)
@@ -29,7 +29,7 @@
 #![experimental]
 
 #![allow(missing_doc)]
-#![allow(non_snake_case_functions)]
+#![allow(non_snake_case)]
 
 use clone::Clone;
 use collections::{Collection, MutableSeq};
index 07ad08e1b3c03a94d971939f3df2c2e746870088..95be3191bab493eb121b5933bdac6c2e6cda06f0 100644 (file)
@@ -161,7 +161,7 @@ pub struct OsRng {
     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,
index 58b3179a297ce747c0eb2cd6ebb6bb94e63599b7..aadc9178e1a00735663038f886bfd8dbfa52686a 100644 (file)
@@ -543,7 +543,7 @@ fn output(w: &mut Writer, idx: int, addr: *mut libc::c_void,
     /// 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 @@ pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut libc::c_void)
 /// 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;
index 3280829f958352d781785ea693d72a0d7ee8427f..6d9b8821bd8903cc58767594388f35a725c044ee 100644 (file)
@@ -157,7 +157,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[allow(non_snake_case_functions)]
+#[allow(non_snake_case)]
 #[test]
 fn lookup_Rust() {
     let abi = lookup("Rust");
index d574a02fded22088bff65c640359c16d77ac5a65..8df6b65cd1654c488611c01f5f64fd603ebd5c00 100644 (file)
@@ -29,7 +29,7 @@
 // FIXME(eddyb) #10676 use Rc<T> in the future.
 pub type P<T> = Gc<T>;
 
-#[allow(non_snake_case_functions)]
+#[allow(non_snake_case)]
 /// Construct a P<T> from a T value.
 pub fn P<T: 'static>(value: T) -> P<T> {
     box(GC) value
index 64a61cc6b3bdcd8d53fcf21745aa188d24b67285..cd61f9bb35ed12c2f16c2f22295c629b7206b908 100644 (file)
@@ -27,7 +27,7 @@ pub struct WinConsole<T> {
     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;
index d6010cd8d7bfbbd467664ccb9b1c237e2d44cf1e..135b267262cc670b9c9c686cec62c649a7f0e7f5 100644 (file)
@@ -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};
index 0f75cf86c18da443e3917ac909e17b3354f84ec7..91e7589b8caebdb24b7988a1db08272a5b720f51 100644 (file)
@@ -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;
 
 
index 2cbbfdb23fe0234df5135867b0a7300cd4766781..49c12334844762b93853ba666c819928ae1aeb73 100644 (file)
@@ -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;
index 7129d4993b74f1cb1116b8f588713aee2b9eafb2..728f6bd043a2680eaaa7fd3c7ba5fa97b4241586 100644 (file)
@@ -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;
index f33c7956a1418f45fab80b5a6ab7cc4d62aa558e..6ce63e2ecdb77dd7db13b861f6163bf4612d3346 100644 (file)
@@ -32,6 +32,8 @@ enum Foo5 {
 trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
 }
 
+fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
+
 #[repr(C)]
 struct foo7 {
     bar: int,
index 4253286996c5a9efca64688a18992d3e84618b6b..ccbe1f006e308e2514076e8274d0d27c64a4af9f 100644 (file)
@@ -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 (file)
index 0000000..64669d9
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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 (file)
index 0000000..5bc8469
--- /dev/null
@@ -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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() { }
index 279cf6d94cbf13626c615f6e6a5237d33e62bc82..902cd63b1e78cdc2f5e584c09a840d578cc6f3d0 100644 (file)
 // 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);
index b5ffa3546c19d02cbbaefc8810762a19aa4a94d3..a5dce6ecc6f3e14d0bcdf6f370c741839a256af4 100644 (file)
@@ -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;
 }
 
index 92f57f34c947d15b3ec641991ffb45f38515811c..9028e68da1fd9357533b50abea481ee7c0563096 100644 (file)
@@ -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;
 }