Auto merge of #3554 - klausi:module_name_repeat, r=oli-obk

chore(module_name_repeat): Rename stutter lint to module_name_repeat to avoid ableist language

See #3521
This commit is contained in:
bors 2018-12-18 13:28:12 +00:00
commit 61de562454
8 changed files with 54 additions and 13 deletions

View File

@ -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_repetitions`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
[`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
@ -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

View File

@ -75,7 +75,7 @@ declare_clippy_lint! {
/// }
/// ```
declare_clippy_lint! {
pub STUTTER,
pub MODULE_NAME_REPETITIONS,
pedantic,
"type names prefixed/postfixed with their containing module's name"
}
@ -126,7 +126,12 @@ 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_REPETITIONS,
MODULE_INCEPTION
)
}
}
@ -277,7 +282,7 @@ impl EarlyLintPass for EnumVariantNames {
match item_camel.chars().nth(nchars) {
Some(c) if is_word_beginning(c) => span_lint(
cx,
STUTTER,
MODULE_NAME_REPETITIONS,
item.span,
"item name starts with its containing module's name",
),
@ -287,7 +292,7 @@ impl EarlyLintPass for EnumVariantNames {
if rmatching == nchars {
span_lint(
cx,
STUTTER,
MODULE_NAME_REPETITIONS,
item.span,
"item name ends with its containing module's name",
);

View File

@ -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_REPETITIONS,
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,
@ -1030,6 +1030,10 @@ 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_repetitions");
}
// only exists to let the dogfood integration test works.
// Don't run clippy as an executable directly
#[allow(dead_code)]

View File

@ -110,6 +110,7 @@ pub fn main() {
ls.register_group(Some(sess), true, name, deprecated_name, to);
}
clippy_lints::register_pre_expansion_lints(sess, &mut ls, &conf);
clippy_lints::register_renamed(&mut ls);
sess.plugin_llvm_passes.borrow_mut().extend(llvm_passes);
sess.plugin_attributes.borrow_mut().extend(attributes);

View File

@ -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_repetitions)]
#![allow(dead_code)]
mod foo {

View File

@ -1,31 +1,31 @@
error: item name starts with its containing module's name
--> $DIR/stutter.rs:15:5
--> $DIR/module_name_repetitions.rs:15:5
|
15 | pub fn foo_bar() {}
| ^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::stutter` implied by `-D warnings`
= note: `-D clippy::module-name-repetitions` implied by `-D warnings`
error: item name ends with its containing module's name
--> $DIR/stutter.rs:16:5
--> $DIR/module_name_repetitions.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_repetitions.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_repetitions.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_repetitions.rs:19:5
|
19 | pub struct Foo7Bar;
| ^^^^^^^^^^^^^^^^^^^

13
tests/ui/rename.rs Normal file
View File

@ -0,0 +1,13 @@
// 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.
#![allow(stutter)]
#[warn(clippy::stutter)]
fn main() {}

18
tests/ui/rename.stderr Normal file
View File

@ -0,0 +1,18 @@
error: unknown lint: `stutter`
--> $DIR/rename.rs:10:10
|
10 | #![allow(stutter)]
| ^^^^^^^
|
= note: `-D unknown-lints` implied by `-D warnings`
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_repetitions`
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
error: aborting due to 2 previous errors