Skip to content

Lints to enforce either pub(<loc>) or pub(in <loc>) #10963

Closed
@LikeLakers2

Description

@LikeLakers2

What it does

These lints would enforce one of the following visibility syntax formats:

  • pub(<loc>)
  • pub(in <loc>)

when <loc> is super, crate, or self.

These lints would not apply when:

  • The visibility is only pub (with no path qualifier), as there is no pub() syntax that gives equivalent functionality.
  • <loc> is a module path (i.e. crate::iter), as that can only be written in the pub(in <loc>) format.

Advantage

Keeps visibility syntax consistent throughout a codebase.

Drawbacks

Enforcing pub(<loc>) may cause some small level of confusion when paired with pub(in crate::some::module), as rust does not allow pub(crate::some::module).

Example

pub(in crate) struct MyData;

could be written as:

pub(crate) struct MyData;

and vice-versa.

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions