Files
rust/tests/ui/module_inception.rs
T
Jason Newcomb 26cf3eee16 Rework module_inception
* Don't check for repetition if the previous module crosses a body boundary.
* Don't take a snippet of the entire item.
* Check each item's visibility once.
* Use `is_from_proc_macro` before linting
2025-09-17 19:42:38 -04:00

51 lines
762 B
Rust

#![warn(clippy::module_inception)]
pub mod foo2 {
pub mod bar2 {
pub mod bar2 {
//~^ module_inception
pub mod foo2 {}
}
pub mod foo2 {}
}
pub mod foo2 {
//~^ module_inception
pub mod bar2 {}
}
}
mod foo {
mod bar {
mod bar {
//~^ module_inception
mod foo {}
}
mod foo {}
}
mod foo {
//~^ module_inception
mod bar {}
}
}
// No warning. See <https://github.com/rust-lang/rust-clippy/issues/1220>.
mod bar {
#[allow(clippy::module_inception)]
mod bar {}
}
mod with_inner_impl {
struct S;
impl S {
fn f() {
mod with_inner_impl {}
}
}
}
fn main() {}