@@ -358,8 +358,18 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
358358 use crate :: html:: format:: print_anchor;
359359
360360 let visibility_and_hidden = visibility_and_hidden ( myitem) ;
361- write ! ( w, "<dt><code>" ) ?;
362- render_attributes_in_code ( w, myitem, "" , cx) ?;
361+ // Module listings use the hidden marker, so skip doc(hidden) here.
362+ let wrote_attrs = super :: render_attributes_in_code_with_options (
363+ w,
364+ myitem,
365+ "" ,
366+ cx,
367+ false ,
368+ Some ( "<dt><code>" ) ,
369+ ) ?;
370+ if !wrote_attrs {
371+ w. write_str ( "<dt><code>" ) ?;
372+ }
363373 match * src {
364374 Some ( src) => {
365375 write ! (
@@ -561,7 +571,7 @@ fn item_function(cx: &Context<'_>, it: &clean::Item, f: &clean::Function) -> imp
561571 let notable_traits = notable_traits_button ( & f. decl . output , cx) . maybe_display ( ) ;
562572
563573 wrap_item ( w, |w| {
564- render_attributes_in_code ( w, it, "" , cx) ?;
574+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
565575 write ! (
566576 w,
567577 "{vis}{constness}{asyncness}{safety}{abi}fn \
@@ -623,7 +633,7 @@ fn item_trait(cx: &Context<'_>, it: &clean::Item, t: &clean::Trait) -> impl fmt:
623633
624634 // Output the trait definition
625635 wrap_item ( w, |mut w| {
626- render_attributes_in_code ( & mut w, it, "" , cx) ?;
636+ let _ = render_attributes_in_code ( & mut w, it, "" , cx) ?;
627637 write ! (
628638 w,
629639 "{vis}{safety}{is_auto}trait {name}{generics}{bounds}" ,
@@ -1201,7 +1211,7 @@ fn item_trait_alias(
12011211) -> impl fmt:: Display {
12021212 fmt:: from_fn ( |w| {
12031213 wrap_item ( w, |w| {
1204- render_attributes_in_code ( w, it, "" , cx) ?;
1214+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
12051215 write ! (
12061216 w,
12071217 "trait {name}{generics} = {bounds}{where_clause};" ,
@@ -1229,7 +1239,7 @@ fn item_trait_alias(
12291239fn item_type_alias ( cx : & Context < ' _ > , it : & clean:: Item , t : & clean:: TypeAlias ) -> impl fmt:: Display {
12301240 fmt:: from_fn ( |w| {
12311241 wrap_item ( w, |w| {
1232- render_attributes_in_code ( w, it, "" , cx) ?;
1242+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
12331243 write ! (
12341244 w,
12351245 "{vis}type {name}{generics}{where_clause} = {type_};" ,
@@ -1437,7 +1447,7 @@ impl<'a, 'cx: 'a> ItemUnion<'a, 'cx> {
14371447
14381448 fn print_field_attrs ( & self , field : & ' a clean:: Item ) -> impl Display {
14391449 fmt:: from_fn ( move |w| {
1440- render_attributes_in_code ( w, field, "" , self . cx ) ?;
1450+ let _ = render_attributes_in_code ( w, field, "" , self . cx ) ?;
14411451 Ok ( ( ) )
14421452 } )
14431453 }
@@ -1529,7 +1539,7 @@ impl<'clean> DisplayEnum<'clean> {
15291539 // For now the only attributes we render for type aliases are `repr` attributes.
15301540 render_repr_attribute_in_code ( w, cx, self . def_id ) ?;
15311541 } else {
1532- render_attributes_in_code ( w, it, "" , cx) ?;
1542+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
15331543 }
15341544 write ! (
15351545 w,
@@ -1668,7 +1678,7 @@ fn render_enum_fields(
16681678 if v. is_stripped ( ) {
16691679 continue ;
16701680 }
1671- render_attributes_in_code ( w, v, TAB , cx) ?;
1681+ let _ = render_attributes_in_code ( w, v, TAB , cx) ?;
16721682 w. write_str ( TAB ) ?;
16731683 match v. kind {
16741684 clean:: VariantItem ( ref var) => match var. kind {
@@ -1752,7 +1762,7 @@ fn item_variants(
17521762 )
17531763 . maybe_display( )
17541764 ) ?;
1755- render_attributes_in_code ( w, variant, "" , cx) ?;
1765+ let _ = render_attributes_in_code ( w, variant, "" , cx) ?;
17561766 if let clean:: VariantItem ( ref var) = variant. kind
17571767 && let clean:: VariantKind :: CLike = var. kind
17581768 {
@@ -1828,7 +1838,7 @@ fn item_variants(
18281838 <a href=\" #{id}\" class=\" anchor field\" >§</a>\
18291839 <code>"
18301840 ) ?;
1831- render_attributes_in_code ( w, field, "" , cx) ?;
1841+ let _ = render_attributes_in_code ( w, field, "" , cx) ?;
18321842 write ! (
18331843 w,
18341844 "{f}: {t}</code>\
@@ -1853,7 +1863,7 @@ fn item_variants(
18531863fn item_macro ( cx : & Context < ' _ > , it : & clean:: Item , t : & clean:: Macro ) -> impl fmt:: Display {
18541864 fmt:: from_fn ( |w| {
18551865 wrap_item ( w, |w| {
1856- render_attributes_in_code ( w, it, "" , cx) ?;
1866+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
18571867 if !t. macro_rules {
18581868 write ! ( w, "{}" , visibility_print_with_space( it, cx) ) ?;
18591869 }
@@ -1921,7 +1931,7 @@ fn item_constant(
19211931 fmt:: from_fn ( |w| {
19221932 wrap_item ( w, |w| {
19231933 let tcx = cx. tcx ( ) ;
1924- render_attributes_in_code ( w, it, "" , cx) ?;
1934+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
19251935
19261936 write ! (
19271937 w,
@@ -1989,7 +1999,7 @@ impl<'a> DisplayStruct<'a> {
19891999 // For now the only attributes we render for type aliases are `repr` attributes.
19902000 render_repr_attribute_in_code ( w, cx, self . def_id ) ?;
19912001 } else {
1992- render_attributes_in_code ( w, it, "" , cx) ?;
2002+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
19932003 }
19942004 write ! (
19952005 w,
@@ -2068,7 +2078,7 @@ fn item_fields(
20682078 <code>",
20692079 item_type = ItemType :: StructField ,
20702080 ) ?;
2071- render_attributes_in_code ( w, field, "" , cx) ?;
2081+ let _ = render_attributes_in_code ( w, field, "" , cx) ?;
20722082 write ! (
20732083 w,
20742084 "{field_name}: {ty}</code>\
@@ -2091,7 +2101,7 @@ fn item_static(
20912101) -> impl fmt:: Display {
20922102 fmt:: from_fn ( move |w| {
20932103 wrap_item ( w, |w| {
2094- render_attributes_in_code ( w, it, "" , cx) ?;
2104+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
20952105 write ! (
20962106 w,
20972107 "{vis}{safe}static {mutability}{name}: {typ}" ,
@@ -2111,7 +2121,7 @@ fn item_foreign_type(cx: &Context<'_>, it: &clean::Item) -> impl fmt::Display {
21112121 fmt:: from_fn ( |w| {
21122122 wrap_item ( w, |w| {
21132123 w. write_str ( "extern {\n " ) ?;
2114- render_attributes_in_code ( w, it, "" , cx) ?;
2124+ let _ = render_attributes_in_code ( w, it, "" , cx) ?;
21152125 write ! ( w, " {}type {};\n }}" , visibility_print_with_space( it, cx) , it. name. unwrap( ) )
21162126 } ) ?;
21172127
@@ -2354,7 +2364,7 @@ fn render_union(
23542364 // For now the only attributes we render for type aliases are `repr` attributes.
23552365 render_repr_attribute_in_code ( f, cx, def_id) ?;
23562366 } else {
2357- render_attributes_in_code ( f, it, "" , cx) ?;
2367+ let _ = render_attributes_in_code ( f, it, "" , cx) ?;
23582368 }
23592369 write ! ( f, "{}union {}" , visibility_print_with_space( it, cx) , it. name. unwrap( ) , ) ?;
23602370
@@ -2385,7 +2395,7 @@ fn render_union(
23852395
23862396 for field in fields {
23872397 if let clean:: StructFieldItem ( ref ty) = field. kind {
2388- render_attributes_in_code ( & mut f, field, " " , cx) ?;
2398+ let _ = render_attributes_in_code ( & mut f, field, " " , cx) ?;
23892399 writeln ! (
23902400 f,
23912401 " {}{}: {}," ,
@@ -2482,7 +2492,7 @@ fn render_struct_fields(
24822492 }
24832493 for field in fields {
24842494 if let clean:: StructFieldItem ( ref ty) = field. kind {
2485- render_attributes_in_code ( w, field, & format ! ( "{tab} " ) , cx) ?;
2495+ let _ = render_attributes_in_code ( w, field, & format ! ( "{tab} " ) , cx) ?;
24862496 writeln ! (
24872497 w,
24882498 "{tab} {vis}{name}: {ty}," ,
0 commit comments