1
Fork 0

Merge crate and restricted visibilities

This commit is contained in:
Jacob Pratt 2022-05-21 14:45:14 -04:00
parent 8cece636b2
commit 7b987e34c0
No known key found for this signature in database
GPG key ID: B80E19E4662B5AA4
8 changed files with 12 additions and 32 deletions

View file

@ -403,10 +403,9 @@ impl<'a> State<'a> {
pub(crate) fn print_visibility(&mut self, vis: &ast::Visibility) {
match vis.kind {
ast::VisibilityKind::Public => self.word_nbsp("pub"),
ast::VisibilityKind::Crate => self.word_nbsp("pub(crate)"),
ast::VisibilityKind::Restricted { ref path, .. } => {
let path = Self::to_string(|s| s.print_path(path, false, 0));
if path == "self" || path == "super" {
if path == "crate" || path == "self" || path == "super" {
self.word_nbsp(format!("pub({})", path))
} else {
self.word_nbsp(format!("pub(in {})", path))