This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1509,8 +1509,6 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>(
15091509 cx : & ' a Context < ' tcx > ,
15101510) -> impl Display + ' a + Captures < ' tcx > {
15111511 use std:: fmt:: Write as _;
1512-
1513- let hidden: & ' static str = if item. is_doc_hidden ( ) { "#[doc(hidden)] " } else { "" } ;
15141512 let vis: Cow < ' static , str > = match item. visibility ( cx. tcx ( ) ) {
15151513 None => "" . into ( ) ,
15161514 Some ( ty:: Visibility :: Public ) => "pub " . into ( ) ,
@@ -1546,8 +1544,13 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>(
15461544 }
15471545 }
15481546 } ;
1547+
1548+ let is_doc_hidden = item. is_doc_hidden ( ) ;
15491549 display_fn ( move |f| {
1550- f. write_str ( & hidden) ?;
1550+ if is_doc_hidden {
1551+ f. write_str ( "#[doc(hidden)] " ) ?;
1552+ }
1553+
15511554 f. write_str ( & vis)
15521555 } )
15531556}
@@ -1561,7 +1564,6 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>(
15611564 item_did : DefId ,
15621565 is_doc_hidden : bool ,
15631566) -> impl Display + ' a + Captures < ' tcx > {
1564- let hidden: & ' static str = if is_doc_hidden { "#[doc(hidden)] " } else { "" } ;
15651567 let vis: Cow < ' static , str > = match visibility {
15661568 None => "" . into ( ) ,
15671569 Some ( ty:: Visibility :: Public ) => "pub " . into ( ) ,
@@ -1587,7 +1589,9 @@ pub(crate) fn visibility_to_src_with_space<'a, 'tcx: 'a>(
15871589 }
15881590 } ;
15891591 display_fn ( move |f| {
1590- f. write_str ( & hidden) ?;
1592+ if is_doc_hidden {
1593+ f. write_str ( "#[doc(hidden)] " ) ?;
1594+ }
15911595 f. write_str ( & vis)
15921596 } )
15931597}
You can’t perform that action at this time.
0 commit comments