Skip to content

Lint to remove instances of pub(self) and pub(in self) #10964

Closed
@LikeLakers2

Description

@LikeLakers2

What it does

This lint would check for instances of pub(self) and pub(in self) and suggest that they be removed.

Advantage

Removes extraneous visibility syntax where it has no effect at all. Per Visibility and Privacy from the Rust Reference:

pub(self) [...] is equivalent to pub(in self) or not using pub at all.

Drawbacks

Some codebases may use pub(self) or pub(in self) to denote a item that is meant for use within a submodule, and the lack of such to denote an item meant only for use within the same file.

Example

pub(self) struct State;

Could be written as:

struct State;

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