@@ -340,6 +340,19 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
340340 }
341341
342342 for ( _, myitem) in & not_stripped_items[ & type_] {
343+ let visibility_and_hidden = |item : & clean:: Item | match item. visibility ( tcx) {
344+ Some ( ty:: Visibility :: Restricted ( _) ) => {
345+ if item. is_doc_hidden ( ) {
346+ // Don't separate with a space when there are two of them
347+ "<span title=\" Restricted Visibility\" > 🔒</span><span title=\" Hidden item\" >👻</span> "
348+ } else {
349+ "<span title=\" Restricted Visibility\" > 🔒</span> "
350+ }
351+ }
352+ _ if item. is_doc_hidden ( ) => "<span title=\" Hidden item\" > 👻</span> " ,
353+ _ => "" ,
354+ } ;
355+
343356 match myitem. kind {
344357 clean:: ExternCrateItem { ref src } => {
345358 use crate :: html:: format:: print_anchor;
@@ -377,6 +390,7 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
377390 print_extra_info_tags ( tcx, myitem, item, Some ( import_def_id) )
378391 . to_string ( )
379392 } ) ;
393+ let visibility_and_hidden = visibility_and_hidden ( myitem) ;
380394 let id = match import. kind {
381395 clean:: ImportKind :: Simple ( s) => {
382396 format ! ( " id=\" {}\" " , cx. derive_id( format!( "reexport.{s}" ) ) )
@@ -388,13 +402,13 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
388402 "<dt{id}>\
389403 <code>"
390404 ) ?;
391- render_attributes_in_code ( w, myitem, "" , cx) ?;
392405 write ! (
393406 w,
394- "{vis}{imp}</code>{stab_tags}\
407+ "{vis}{imp}</code>{visibility_and_hidden}{ stab_tags}\
395408 </dt>",
396409 vis = visibility_print_with_space( myitem, cx) ,
397410 imp = print_import( import, cx) ,
411+ visibility_and_hidden = visibility_and_hidden,
398412 ) ?;
399413 }
400414 _ => {
@@ -414,20 +428,7 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
414428 }
415429 _ => "" ,
416430 } ;
417- let visibility_and_hidden = match myitem. visibility ( tcx) {
418- Some ( ty:: Visibility :: Restricted ( _) ) => {
419- if myitem. is_doc_hidden ( ) {
420- // Don't separate with a space when there are two of them
421- "<span title=\" Restricted Visibility\" > 🔒</span><span title=\" Hidden item\" >👻</span> "
422- } else {
423- "<span title=\" Restricted Visibility\" > 🔒</span> "
424- }
425- }
426- _ if myitem. is_doc_hidden ( ) => {
427- "<span title=\" Hidden item\" > 👻</span> "
428- }
429- _ => "" ,
430- } ;
431+ let visibility_and_hidden = visibility_and_hidden ( myitem) ;
431432
432433 let docs = MarkdownSummaryLine ( & myitem. doc_value ( ) , & myitem. links ( cx) )
433434 . into_string ( ) ;
0 commit comments