Skip to content

No location reported for module_name_repetitions #3892

Closed
@simon-bourne

Description

@simon-bourne

Hi,

Clippy fails to give a location for module_name_repetitions in some cases. It looks like it's when an attribute matches the module name. Here's the steps to reproduce:

cargo new --lib clippy-test
cd clippy-test

Change the module inside src/lib.rs from tests to test:

#[cfg(test)]
mod test {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}

Then run cargo clippy --tests -- -D clippy::pedantic, which outputs:

    Checking clippy-test v0.1.0 (/some_path/clippy-test)
error: item name starts with its containing module's name
  |
  = note: `-D clippy::module-name-repetitions` implied by `-D clippy::pedantic`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: aborting due to previous error

error: Could not compile `clippy-test`.

To learn more, run the command again with --verbose.

Regards,

Simon

Versions:

clippy 0.0.212 (1b89724 2019-01-15)
cargo 1.33.0 (f099fe94b 2019-02-12)

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions