]> git.lizzy.rs Git - rust.git/commitdiff
Rename lint to MODULE_NAME_REPETITIONS
authorflip1995 <hello@philkrones.com>
Mon, 17 Dec 2018 13:29:19 +0000 (14:29 +0100)
committerflip1995 <hello@philkrones.com>
Mon, 17 Dec 2018 13:29:19 +0000 (14:29 +0100)
clippy_lints/src/enum_variants.rs
clippy_lints/src/lib.rs
tests/ui/module_name_repeat.rs [deleted file]
tests/ui/module_name_repeat.stderr [deleted file]
tests/ui/module_name_repetitions.rs [new file with mode: 0644]
tests/ui/module_name_repetitions.stderr [new file with mode: 0644]
tests/ui/rename.stderr

index 861e1177296cf213623afd6dab258e5d796a0960..c6142a168548a149326213fc1a33827736210e0d 100644 (file)
@@ -75,7 +75,7 @@
 /// }
 /// ```
 declare_clippy_lint! {
-    pub MODULE_NAME_REPEAT,
+    pub MODULE_NAME_REPETITIONS,
     pedantic,
     "type names prefixed/postfixed with their containing module's name"
 }
@@ -126,7 +126,12 @@ pub fn new(threshold: u64) -> Self {
 
 impl LintPass for EnumVariantNames {
     fn get_lints(&self) -> LintArray {
-        lint_array!(ENUM_VARIANT_NAMES, PUB_ENUM_VARIANT_NAMES, MODULE_NAME_REPEAT, MODULE_INCEPTION)
+        lint_array!(
+            ENUM_VARIANT_NAMES,
+            PUB_ENUM_VARIANT_NAMES,
+            MODULE_NAME_REPETITIONS,
+            MODULE_INCEPTION
+        )
     }
 }
 
@@ -277,7 +282,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
                             match item_camel.chars().nth(nchars) {
                                 Some(c) if is_word_beginning(c) => span_lint(
                                     cx,
-                                    MODULE_NAME_REPEAT,
+                                    MODULE_NAME_REPETITIONS,
                                     item.span,
                                     "item name starts with its containing module's name",
                                 ),
@@ -287,7 +292,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
                         if rmatching == nchars {
                             span_lint(
                                 cx,
-                                MODULE_NAME_REPEAT,
+                                MODULE_NAME_REPETITIONS,
                                 item.span,
                                 "item name ends with its containing module's name",
                             );
index 5c1469536f5152450b62b0695befe141e04f8220..8ce5861a939b674a416f2b5ef015a2a69e999523 100644 (file)
@@ -517,7 +517,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         doc::DOC_MARKDOWN,
         empty_enum::EMPTY_ENUM,
         enum_glob_use::ENUM_GLOB_USE,
-        enum_variants::MODULE_NAME_REPEAT,
+        enum_variants::MODULE_NAME_REPETITIONS,
         enum_variants::PUB_ENUM_VARIANT_NAMES,
         if_not_else::IF_NOT_ELSE,
         infinite_iter::MAYBE_INFINITE_ITER,
@@ -1031,7 +1031,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
 }
 
 pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
-    ls.register_renamed("clippy::stutter", "clippy::module_name_repeat");
+    ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
 }
 
 // only exists to let the dogfood integration test works.
diff --git a/tests/ui/module_name_repeat.rs b/tests/ui/module_name_repeat.rs
deleted file mode 100644 (file)
index a302eaa..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// 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.
-
-#![warn(clippy::module_name_repeat)]
-#![allow(dead_code)]
-
-mod foo {
-    pub fn foo() {}
-    pub fn foo_bar() {}
-    pub fn bar_foo() {}
-    pub struct FooCake {}
-    pub enum CakeFoo {}
-    pub struct Foo7Bar;
-
-    // Should not warn
-    pub struct Foobar;
-}
-
-fn main() {}
diff --git a/tests/ui/module_name_repeat.stderr b/tests/ui/module_name_repeat.stderr
deleted file mode 100644 (file)
index 9547fa9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-error: item name starts with its containing module's name
-  --> $DIR/module_name_repeat.rs:15:5
-   |
-15 |     pub fn foo_bar() {}
-   |     ^^^^^^^^^^^^^^^^^^^
-   |
-   = note: `-D clippy::module-name-repeat` implied by `-D warnings`
-
-error: item name ends with its containing module's name
-  --> $DIR/module_name_repeat.rs:16:5
-   |
-16 |     pub fn bar_foo() {}
-   |     ^^^^^^^^^^^^^^^^^^^
-
-error: item name starts with its containing module's name
-  --> $DIR/module_name_repeat.rs:17:5
-   |
-17 |     pub struct FooCake {}
-   |     ^^^^^^^^^^^^^^^^^^^^^
-
-error: item name ends with its containing module's name
-  --> $DIR/module_name_repeat.rs:18:5
-   |
-18 |     pub enum CakeFoo {}
-   |     ^^^^^^^^^^^^^^^^^^^
-
-error: item name starts with its containing module's name
-  --> $DIR/module_name_repeat.rs:19:5
-   |
-19 |     pub struct Foo7Bar;
-   |     ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
diff --git a/tests/ui/module_name_repetitions.rs b/tests/ui/module_name_repetitions.rs
new file mode 100644 (file)
index 0000000..4db4f56
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// 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.
+
+#![warn(clippy::module_name_repetitions)]
+#![allow(dead_code)]
+
+mod foo {
+    pub fn foo() {}
+    pub fn foo_bar() {}
+    pub fn bar_foo() {}
+    pub struct FooCake {}
+    pub enum CakeFoo {}
+    pub struct Foo7Bar;
+
+    // Should not warn
+    pub struct Foobar;
+}
+
+fn main() {}
diff --git a/tests/ui/module_name_repetitions.stderr b/tests/ui/module_name_repetitions.stderr
new file mode 100644 (file)
index 0000000..e2eca64
--- /dev/null
@@ -0,0 +1,34 @@
+error: item name starts with its containing module's name
+  --> $DIR/module_name_repetitions.rs:15:5
+   |
+15 |     pub fn foo_bar() {}
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::module-name-repetitions` implied by `-D warnings`
+
+error: item name ends with its containing module's name
+  --> $DIR/module_name_repetitions.rs:16:5
+   |
+16 |     pub fn bar_foo() {}
+   |     ^^^^^^^^^^^^^^^^^^^
+
+error: item name starts with its containing module's name
+  --> $DIR/module_name_repetitions.rs:17:5
+   |
+17 |     pub struct FooCake {}
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
+error: item name ends with its containing module's name
+  --> $DIR/module_name_repetitions.rs:18:5
+   |
+18 |     pub enum CakeFoo {}
+   |     ^^^^^^^^^^^^^^^^^^^
+
+error: item name starts with its containing module's name
+  --> $DIR/module_name_repetitions.rs:19:5
+   |
+19 |     pub struct Foo7Bar;
+   |     ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
index 9aa22eb6c457780e9c16a3e827c986164ea8a232..7ad8228fb359449019f88bf33f043399a45df625 100644 (file)
@@ -6,11 +6,11 @@ error: unknown lint: `stutter`
    |
    = note: `-D unknown-lints` implied by `-D warnings`
 
-error: lint `clippy::stutter` has been renamed to `clippy::module_name_repeat`
+error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
   --> $DIR/rename.rs:12:8
    |
 12 | #[warn(clippy::stutter)]
-   |        ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repeat`
+   |        ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
    |
    = note: `-D renamed-and-removed-lints` implied by `-D warnings`