Improve span for module_name_repetitions

This commit is contained in:
Martin Fischer 2023-01-25 07:07:10 +01:00
parent a9c251f11d
commit 20cc72e8a8
2 changed files with 12 additions and 12 deletions

View File

@ -277,7 +277,7 @@ impl LateLintPass<'_> for EnumVariantNames {
Some(c) if is_word_beginning(c) => span_lint( Some(c) if is_word_beginning(c) => span_lint(
cx, cx,
MODULE_NAME_REPETITIONS, MODULE_NAME_REPETITIONS,
item.span, item.ident.span,
"item name starts with its containing module's name", "item name starts with its containing module's name",
), ),
_ => (), _ => (),
@ -287,7 +287,7 @@ impl LateLintPass<'_> for EnumVariantNames {
span_lint( span_lint(
cx, cx,
MODULE_NAME_REPETITIONS, MODULE_NAME_REPETITIONS,
item.span, item.ident.span,
"item name ends with its containing module's name", "item name ends with its containing module's name",
); );
} }

View File

@ -1,34 +1,34 @@
error: item name starts with its containing module's name error: item name starts with its containing module's name
--> $DIR/module_name_repetitions.rs:8:5 --> $DIR/module_name_repetitions.rs:8:12
| |
LL | pub fn foo_bar() {} LL | pub fn foo_bar() {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
| |
= note: `-D clippy::module-name-repetitions` implied by `-D warnings` = note: `-D clippy::module-name-repetitions` implied by `-D warnings`
error: item name ends with its containing module's name error: item name ends with its containing module's name
--> $DIR/module_name_repetitions.rs:9:5 --> $DIR/module_name_repetitions.rs:9:12
| |
LL | pub fn bar_foo() {} LL | pub fn bar_foo() {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: item name starts with its containing module's name error: item name starts with its containing module's name
--> $DIR/module_name_repetitions.rs:10:5 --> $DIR/module_name_repetitions.rs:10:16
| |
LL | pub struct FooCake; LL | pub struct FooCake;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: item name ends with its containing module's name error: item name ends with its containing module's name
--> $DIR/module_name_repetitions.rs:11:5 --> $DIR/module_name_repetitions.rs:11:14
| |
LL | pub enum CakeFoo {} LL | pub enum CakeFoo {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: item name starts with its containing module's name error: item name starts with its containing module's name
--> $DIR/module_name_repetitions.rs:12:5 --> $DIR/module_name_repetitions.rs:12:16
| |
LL | pub struct Foo7Bar; LL | pub struct Foo7Bar;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: aborting due to 5 previous errors error: aborting due to 5 previous errors