Skip to content

disable module_inception for private modules  #10842

@wookietreiber

Description

@wookietreiber

Description

I often find myself splitting up modules when they start to feel unwieldy. Instead of having a single thing.rs module with everything in it, I'd split it up in private sub-modules with re-exports like this:

// thing/mod.rs
mod thing;
mod builder;
// other modules 

pub use thing::Thing;
pub use builder::Builder as ThingBuilder;
// other re-exports of stuff in private modules
// thing/thing.rs
pub struct Thing;

Running clippy warns about module inception on the private mod thing, even though due to it not being pub it doesn't show up in the public API and can't be used as thing::thing::Thing. The (current) lint description is about exactly this issue, i.e. to avoid users of the API having to use thing::thing::Thing.

Thus, to me it doesn't make sense to apply this lint to private modules. Am I missing something?

Version

rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions