@@ -432,13 +432,7 @@ pub fn mac_to_string(arg: &ast::Mac) -> String {
432
432
}
433
433
434
434
pub fn visibility_qualified ( vis : & ast:: Visibility , s : & str ) -> String {
435
- match * vis {
436
- ast:: Visibility :: Public => format ! ( "pub {}" , s) ,
437
- ast:: Visibility :: Crate ( _) => format ! ( "pub(crate) {}" , s) ,
438
- ast:: Visibility :: Restricted { ref path, .. } =>
439
- format ! ( "pub({}) {}" , to_string( |s| s. print_path( path, false , 0 , true ) ) , s) ,
440
- ast:: Visibility :: Inherited => s. to_string ( )
441
- }
435
+ format ! ( "{}{}" , to_string( |s| s. print_visibility( vis) ) , s)
442
436
}
443
437
444
438
fn needs_parentheses ( expr : & ast:: Expr ) -> bool {
@@ -1473,7 +1467,11 @@ impl<'a> State<'a> {
1473
1467
ast:: Visibility :: Crate ( _) => self . word_nbsp ( "pub(crate)" ) ,
1474
1468
ast:: Visibility :: Restricted { ref path, .. } => {
1475
1469
let path = to_string ( |s| s. print_path ( path, false , 0 , true ) ) ;
1476
- self . word_nbsp ( & format ! ( "pub({})" , path) )
1470
+ if path == "self" || path == "super" {
1471
+ self . word_nbsp ( & format ! ( "pub({})" , path) )
1472
+ } else {
1473
+ self . word_nbsp ( & format ! ( "pub(in {})" , path) )
1474
+ }
1477
1475
}
1478
1476
ast:: Visibility :: Inherited => Ok ( ( ) )
1479
1477
}
0 commit comments