What it does
These lints would enforce one of the following visibility syntax formats:
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.
What it does
These lints would enforce one of the following visibility syntax formats:
pub(<loc>)pub(in <loc>)when
<loc>issuper,crate, orself.These lints would not apply when:
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 withpub(in crate::some::module), as rust does not allowpub(crate::some::module).Example
could be written as:
and vice-versa.