Closed
Description
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 nopub()
syntax that gives equivalent functionality. <loc>
is a module path (i.e.crate::iter
), as that can only be written in thepub(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.