Skip to content

Suggestion: Split unreachable_pub lint into multiple lints #112615

Open
@jplatte

Description

@jplatte

Hi, I just tried to use the unreachable_pub lint in a medium-sized project and IMO, it's rather noisy about fields and methods, which, to me, are much less important targets to this lint than types. The reason I want to use the lint is (1) to make sure I don't forget to re-export types from modules that aren't supposed to be public, and (2) to make it more obvious at declaration site whether something is part of the public API.

(1) doesn't apply to fields and methods at all, and (2) matters much less for them as opposed to types, since it's generally already easy enough to tell when they're not part of the public API because they are part of a type that isn't.

Because of that, it would be great if I could enable this lint for types only, and not have to change all the pub fields and methods in pub(crate) types to also have pub(crate) visibility. For fields in particular this just feels like line noise.

@rustbot label +A-lint +A-visibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.L-unreachable_pubLint: unreachable_pubT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions