Add the allow_exact_repetitions option to the module_name_repetitions lint.

This commit is contained in:
SLUCHABLUB 2025-05-14 10:49:01 +02:00
parent 373df5265e
commit 488e4e53d2
8 changed files with 59 additions and 5 deletions

View file

@ -0,0 +1 @@
allow-exact-repetitions = false

View file

@ -0,0 +1,13 @@
#![warn(clippy::module_name_repetitions)]
#![allow(dead_code)]
pub mod foo {
// this line should produce a warning:
pub fn foo() {}
//~^ module_name_repetitions
// but this line shouldn't
pub fn to_foo() {}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: item name is the same as its containing module's name
--> tests/ui-toml/item_name_repetitions/allow_exact_repetitions/item_name_repetitions.rs:6:12
|
LL | pub fn foo() {}
| ^^^
|
= note: `-D clippy::module-name-repetitions` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::module_name_repetitions)]`
error: aborting due to 1 previous error

View file

@ -5,6 +5,7 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
accept-comment-above-statement
allow-comparison-to-zero
allow-dbg-in-tests
allow-exact-repetitions
allow-expect-in-consts
allow-expect-in-tests
allow-indexing-slicing-in-tests
@ -98,6 +99,7 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
accept-comment-above-statement
allow-comparison-to-zero
allow-dbg-in-tests
allow-exact-repetitions
allow-expect-in-consts
allow-expect-in-tests
allow-indexing-slicing-in-tests
@ -191,6 +193,7 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
accept-comment-above-statement
allow-comparison-to-zero
allow-dbg-in-tests
allow-exact-repetitions
allow-expect-in-consts
allow-expect-in-tests
allow-indexing-slicing-in-tests