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

Lint on pub(crate) inside private mod #5274

Closed
1tgr opened this issue Mar 5, 2020 · 0 comments · Fixed by #5319
Closed

Lint on pub(crate) inside private mod #5274

1tgr opened this issue Mar 5, 2020 · 0 comments · Fixed by #5319
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code

Comments

@1tgr
Copy link
Contributor

1tgr commented Mar 5, 2020

pub(crate) within mod is redundant as the parent mod is not public:

mod a {
    pub(crate) fn f() { }

    // f is not accessible outside of a, so it's the same as:
    // pub fn f() { }
}

It's also redundant to re-state pub(crate):

pub(crate) mod b {
    pub(crate) fn g() { }

    // b is already crate-visible, so g is the same as:
    // pub fn g() { }
}
@flip1995 flip1995 added L-unnecessary Lint: Warn about unnecessary code good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints labels Mar 9, 2020
1tgr added a commit to 1tgr/rust-clippy that referenced this issue Mar 15, 2020
bors added a commit that referenced this issue Mar 23, 2020
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them

changelog: Add `redundant_pub_crate` lint

Closes #5274.
@bors bors closed this as completed in 52208f3 Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code
Projects
None yet
2 participants