Skip to content

disable module_inception for private modules #10842

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

Closed
wookietreiber opened this issue May 29, 2023 · 1 comment · Fixed by #10917
Closed

disable module_inception for private modules #10842

wookietreiber opened this issue May 29, 2023 · 1 comment · Fixed by #10917
Assignees

Comments

@wookietreiber
Copy link

wookietreiber commented May 29, 2023

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

@Centri3
Copy link
Member

Centri3 commented Jun 4, 2023

@rustbot claim

bors added a commit that referenced this issue Jun 10, 2023
allow disabling module inception on private modules

Fixes #10842

changelog: Enhancement [`module_inception`]: Added `allow-private-module-inception` configuration.
[#10917](#10917)
<!-- changelog_checked -->
@bors bors closed this as completed in e986b64 Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants