Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow numbers in module_name_repetitions #12714

Open
TomFryersMidsummer opened this issue Apr 25, 2024 · 0 comments
Open

Allow numbers in module_name_repetitions #12714

TomFryersMidsummer opened this issue Apr 25, 2024 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@TomFryersMidsummer
Copy link

Summary

Suppose I have a module vector, containing a Vector2 type. This seems fine to me – I can't name the type 2, after all. However module_name_repetitions disagrees.

Maybe this should apply to all short affixes more generally (one or perhaps two letters). I'm not sure.

Lint Name

module_name_repetitions

Reproducer

I tried this code:

pub mod vector {
    pub struct Vector2(pub f64, pub f64);
}

I saw this happen:

$ clippy-driver --crate-type lib -Wclippy::pedantic test.rs 
warning: item name starts with its containing module's name
 --> test.rs:2:16
  |
2 |     pub struct Vector2(pub f64, pub f64);
  |                ^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
  = note: `-W clippy::module-name-repetitions` implied by `-W clippy::pedantic`
  = help: to override `-W clippy::pedantic` add `#[allow(clippy::module_name_repetitions)]`

warning: 1 warning emitted

I expected to see this happen: [no error]

Version

rustc 1.79.0-nightly (ef8b9dcf2 2024-04-24)
binary: rustc
commit-hash: ef8b9dcf23700f2e2265317611460d3a65c19eff
commit-date: 2024-04-24
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.4

Additional Labels

No response

@TomFryersMidsummer TomFryersMidsummer added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

1 participant