Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ All notable changes to this project will be documented in this file.
[`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
[`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals
[`module_inception`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
[`module_name_repeat`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repeat
[`modulo_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
[`multiple_crate_versions`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
[`multiple_inherent_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_inherent_impl
Expand Down Expand Up @@ -850,7 +851,6 @@ All notable changes to this project will be documented in this file.
[`string_extend_chars`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_extend_chars
[`string_lit_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_lit_as_bytes
[`string_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_to_string
[`stutter`]: https://rust-lang.github.io/rust-clippy/master/index.html#stutter
[`suspicious_arithmetic_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_arithmetic_impl
[`suspicious_assignment_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_assignment_formatting
[`suspicious_else_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ declare_clippy_lint! {
/// }
/// ```
declare_clippy_lint! {
pub STUTTER,
pub MODULE_NAME_REPEAT,
pedantic,
"type names prefixed/postfixed with their containing module's name"
}
Expand Down Expand Up @@ -126,7 +126,7 @@ impl EnumVariantNames {

impl LintPass for EnumVariantNames {
fn get_lints(&self) -> LintArray {
lint_array!(ENUM_VARIANT_NAMES, PUB_ENUM_VARIANT_NAMES, STUTTER, MODULE_INCEPTION)
lint_array!(ENUM_VARIANT_NAMES, PUB_ENUM_VARIANT_NAMES, MODULE_NAME_REPEAT, MODULE_INCEPTION)
}
}

Expand Down Expand Up @@ -277,7 +277,7 @@ impl EarlyLintPass for EnumVariantNames {
match item_camel.chars().nth(nchars) {
Some(c) if is_word_beginning(c) => span_lint(
cx,
STUTTER,
MODULE_NAME_REPEAT,
item.span,
"item name starts with its containing module's name",
),
Expand All @@ -287,7 +287,7 @@ impl EarlyLintPass for EnumVariantNames {
if rmatching == nchars {
span_lint(
cx,
STUTTER,
MODULE_NAME_REPEAT,
item.span,
"item name ends with its containing module's name",
);
Expand Down
4 changes: 3 additions & 1 deletion clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ 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::PUB_ENUM_VARIANT_NAMES,
enum_variants::STUTTER,
if_not_else::IF_NOT_ELSE,
infinite_iter::MAYBE_INFINITE_ITER,
items_after_statements::ITEMS_AFTER_STATEMENTS,
Expand Down Expand Up @@ -1028,6 +1028,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
unwrap::PANICKING_UNWRAP,
unwrap::UNNECESSARY_UNWRAP,
]);

store.register_renamed("stutter", "module_name_repeat");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need clippy::stutter here?

}

// only exists to let the dogfood integration test works.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/stutter.rs → tests/ui/module_name_repeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![warn(clippy::stutter)]
#![warn(clippy::module_name_repeat)]
#![allow(dead_code)]

mod foo {
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/stutter.stderr → tests/ui/module_name_repeat.stderr
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
error: item name starts with its containing module's name
--> $DIR/stutter.rs:15:5
--> $DIR/module_name_repeat.rs:15:5
|
15 | pub fn foo_bar() {}
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::stutter` implied by `-D warnings`
= note: `-D clippy::module-name-repeat` implied by `-D warnings`

error: item name ends with its containing module's name
--> $DIR/stutter.rs:16:5
--> $DIR/module_name_repeat.rs:16:5
|
16 | pub fn bar_foo() {}
| ^^^^^^^^^^^^^^^^^^^

error: item name starts with its containing module's name
--> $DIR/stutter.rs:17:5
--> $DIR/module_name_repeat.rs:17:5
|
17 | pub struct FooCake {}
| ^^^^^^^^^^^^^^^^^^^^^

error: item name ends with its containing module's name
--> $DIR/stutter.rs:18:5
--> $DIR/module_name_repeat.rs:18:5
|
18 | pub enum CakeFoo {}
| ^^^^^^^^^^^^^^^^^^^

error: item name starts with its containing module's name
--> $DIR/stutter.rs:19:5
--> $DIR/module_name_repeat.rs:19:5
|
19 | pub struct Foo7Bar;
| ^^^^^^^^^^^^^^^^^^^
Expand Down