Skip to content

Commit 23ea47b

Browse files
committed
Auto merge of #10226 - not-my-profile:module_name_repetitions-span, r=giraffate
Improve span for module_name_repetitions changelog: [`module_name_repetitions`]: Narrowed span to the identifier
2 parents a9c251f + 20cc72e commit 23ea47b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

clippy_lints/src/enum_variants.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ impl LateLintPass<'_> for EnumVariantNames {
277277
Some(c) if is_word_beginning(c) => span_lint(
278278
cx,
279279
MODULE_NAME_REPETITIONS,
280-
item.span,
280+
item.ident.span,
281281
"item name starts with its containing module's name",
282282
),
283283
_ => (),
@@ -287,7 +287,7 @@ impl LateLintPass<'_> for EnumVariantNames {
287287
span_lint(
288288
cx,
289289
MODULE_NAME_REPETITIONS,
290-
item.span,
290+
item.ident.span,
291291
"item name ends with its containing module's name",
292292
);
293293
}
+10-10
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
error: item name starts with its containing module's name
2-
--> $DIR/module_name_repetitions.rs:8:5
2+
--> $DIR/module_name_repetitions.rs:8:12
33
|
44
LL | pub fn foo_bar() {}
5-
| ^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^
66
|
77
= note: `-D clippy::module-name-repetitions` implied by `-D warnings`
88

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

1515
error: item name starts with its containing module's name
16-
--> $DIR/module_name_repetitions.rs:10:5
16+
--> $DIR/module_name_repetitions.rs:10:16
1717
|
1818
LL | pub struct FooCake;
19-
| ^^^^^^^^^^^^^^^^^^^
19+
| ^^^^^^^
2020

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

2727
error: item name starts with its containing module's name
28-
--> $DIR/module_name_repetitions.rs:12:5
28+
--> $DIR/module_name_repetitions.rs:12:16
2929
|
3030
LL | pub struct Foo7Bar;
31-
| ^^^^^^^^^^^^^^^^^^^
31+
| ^^^^^^^
3232

3333
error: aborting due to 5 previous errors
3434

0 commit comments

Comments
 (0)