Skip to content

Commit 61de562

Browse files
committed
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
2 parents 176778f + d74288e commit 61de562

File tree

8 files changed

+54
-13
lines changed

8 files changed

+54
-13
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ All notable changes to this project will be documented in this file.
760760
[`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
761761
[`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals
762762
[`module_inception`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
763+
[`module_name_repetitions`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
763764
[`modulo_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
764765
[`multiple_crate_versions`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
765766
[`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.
850851
[`string_extend_chars`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_extend_chars
851852
[`string_lit_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_lit_as_bytes
852853
[`string_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_to_string
853-
[`stutter`]: https://rust-lang.github.io/rust-clippy/master/index.html#stutter
854854
[`suspicious_arithmetic_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_arithmetic_impl
855855
[`suspicious_assignment_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_assignment_formatting
856856
[`suspicious_else_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting

clippy_lints/src/enum_variants.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ declare_clippy_lint! {
7575
/// }
7676
/// ```
7777
declare_clippy_lint! {
78-
pub STUTTER,
78+
pub MODULE_NAME_REPETITIONS,
7979
pedantic,
8080
"type names prefixed/postfixed with their containing module's name"
8181
}
@@ -126,7 +126,12 @@ impl EnumVariantNames {
126126

127127
impl LintPass for EnumVariantNames {
128128
fn get_lints(&self) -> LintArray {
129-
lint_array!(ENUM_VARIANT_NAMES, PUB_ENUM_VARIANT_NAMES, STUTTER, MODULE_INCEPTION)
129+
lint_array!(
130+
ENUM_VARIANT_NAMES,
131+
PUB_ENUM_VARIANT_NAMES,
132+
MODULE_NAME_REPETITIONS,
133+
MODULE_INCEPTION
134+
)
130135
}
131136
}
132137

@@ -277,7 +282,7 @@ impl EarlyLintPass for EnumVariantNames {
277282
match item_camel.chars().nth(nchars) {
278283
Some(c) if is_word_beginning(c) => span_lint(
279284
cx,
280-
STUTTER,
285+
MODULE_NAME_REPETITIONS,
281286
item.span,
282287
"item name starts with its containing module's name",
283288
),
@@ -287,7 +292,7 @@ impl EarlyLintPass for EnumVariantNames {
287292
if rmatching == nchars {
288293
span_lint(
289294
cx,
290-
STUTTER,
295+
MODULE_NAME_REPETITIONS,
291296
item.span,
292297
"item name ends with its containing module's name",
293298
);

clippy_lints/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
517517
doc::DOC_MARKDOWN,
518518
empty_enum::EMPTY_ENUM,
519519
enum_glob_use::ENUM_GLOB_USE,
520+
enum_variants::MODULE_NAME_REPETITIONS,
520521
enum_variants::PUB_ENUM_VARIANT_NAMES,
521-
enum_variants::STUTTER,
522522
if_not_else::IF_NOT_ELSE,
523523
infinite_iter::MAYBE_INFINITE_ITER,
524524
items_after_statements::ITEMS_AFTER_STATEMENTS,
@@ -1030,6 +1030,10 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
10301030
]);
10311031
}
10321032

1033+
pub fn register_renamed(ls: &mut rustc::lint::LintStore) {
1034+
ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
1035+
}
1036+
10331037
// only exists to let the dogfood integration test works.
10341038
// Don't run clippy as an executable directly
10351039
#[allow(dead_code)]

src/driver.rs

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn main() {
110110
ls.register_group(Some(sess), true, name, deprecated_name, to);
111111
}
112112
clippy_lints::register_pre_expansion_lints(sess, &mut ls, &conf);
113+
clippy_lints::register_renamed(&mut ls);
113114

114115
sess.plugin_llvm_passes.borrow_mut().extend(llvm_passes);
115116
sess.plugin_attributes.borrow_mut().extend(attributes);

tests/ui/stutter.rs renamed to tests/ui/module_name_repetitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
#![warn(clippy::stutter)]
10+
#![warn(clippy::module_name_repetitions)]
1111
#![allow(dead_code)]
1212

1313
mod foo {

tests/ui/stutter.stderr renamed to tests/ui/module_name_repetitions.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: item name starts with its containing module's name
2-
--> $DIR/stutter.rs:15:5
2+
--> $DIR/module_name_repetitions.rs:15:5
33
|
44
15 | pub fn foo_bar() {}
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::stutter` implied by `-D warnings`
7+
= note: `-D clippy::module-name-repetitions` implied by `-D warnings`
88

99
error: item name ends with its containing module's name
10-
--> $DIR/stutter.rs:16:5
10+
--> $DIR/module_name_repetitions.rs:16:5
1111
|
1212
16 | pub fn bar_foo() {}
1313
| ^^^^^^^^^^^^^^^^^^^
1414

1515
error: item name starts with its containing module's name
16-
--> $DIR/stutter.rs:17:5
16+
--> $DIR/module_name_repetitions.rs:17:5
1717
|
1818
17 | pub struct FooCake {}
1919
| ^^^^^^^^^^^^^^^^^^^^^
2020

2121
error: item name ends with its containing module's name
22-
--> $DIR/stutter.rs:18:5
22+
--> $DIR/module_name_repetitions.rs:18:5
2323
|
2424
18 | pub enum CakeFoo {}
2525
| ^^^^^^^^^^^^^^^^^^^
2626

2727
error: item name starts with its containing module's name
28-
--> $DIR/stutter.rs:19:5
28+
--> $DIR/module_name_repetitions.rs:19:5
2929
|
3030
19 | pub struct Foo7Bar;
3131
| ^^^^^^^^^^^^^^^^^^^

tests/ui/rename.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution.
3+
//
4+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7+
// option. This file may not be copied, modified, or distributed
8+
// except according to those terms.
9+
10+
#![allow(stutter)]
11+
12+
#[warn(clippy::stutter)]
13+
fn main() {}

tests/ui/rename.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: unknown lint: `stutter`
2+
--> $DIR/rename.rs:10:10
3+
|
4+
10 | #![allow(stutter)]
5+
| ^^^^^^^
6+
|
7+
= note: `-D unknown-lints` implied by `-D warnings`
8+
9+
error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
10+
--> $DIR/rename.rs:12:8
11+
|
12+
12 | #[warn(clippy::stutter)]
13+
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
14+
|
15+
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
16+
17+
error: aborting due to 2 previous errors
18+

0 commit comments

Comments
 (0)