@@ -3002,7 +3002,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
30023002fn item_constant ( w : & mut fmt:: Formatter < ' _ > , cx : & Context , it : & clean:: Item ,
30033003 c : & clean:: Constant ) -> fmt:: Result {
30043004 write ! ( w, "<pre class='rust const'>" ) ?;
3005- render_attributes ( w, it) ?;
3005+ render_attributes ( w, it, false ) ?;
30063006 write ! ( w, "{vis}const \
30073007 {name}: {typ}</pre>",
30083008 vis = VisSpace ( & it. visibility) ,
@@ -3014,7 +3014,7 @@ fn item_constant(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
30143014fn item_static ( w : & mut fmt:: Formatter < ' _ > , cx : & Context , it : & clean:: Item ,
30153015 s : & clean:: Static ) -> fmt:: Result {
30163016 write ! ( w, "<pre class='rust static'>" ) ?;
3017- render_attributes ( w, it) ?;
3017+ render_attributes ( w, it, false ) ?;
30183018 write ! ( w, "{vis}static {mutability}\
30193019 {name}: {typ}</pre>",
30203020 vis = VisSpace ( & it. visibility) ,
@@ -3037,7 +3037,7 @@ fn item_function(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
30373037 f. generics
30383038 ) . len ( ) ;
30393039 write ! ( w, "{}<pre class='rust fn'>" , render_spotlight_traits( it) ?) ?;
3040- render_attributes ( w, it) ?;
3040+ render_attributes ( w, it, false ) ?;
30413041 write ! ( w,
30423042 "{vis}{constness}{unsafety}{asyncness}{abi}fn \
30433043 {name}{generics}{decl}{where_clause}</pre>",
@@ -3126,7 +3126,7 @@ fn item_trait(
31263126 // Output the trait definition
31273127 wrap_into_docblock ( w, |w| {
31283128 write ! ( w, "<pre class='rust trait'>" ) ?;
3129- render_attributes ( w, it) ?;
3129+ render_attributes ( w, it, true ) ?;
31303130 write ! ( w, "{}{}{}trait {}{}{}" ,
31313131 VisSpace ( & it. visibility) ,
31323132 UnsafetySpace ( t. unsafety) ,
@@ -3479,7 +3479,7 @@ fn render_assoc_item(w: &mut fmt::Formatter<'_>,
34793479 } else {
34803480 ( 0 , true )
34813481 } ;
3482- render_attributes ( w, meth) ?;
3482+ render_attributes ( w, meth, false ) ?;
34833483 write ! ( w, "{}{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
34843484 {generics}{decl}{where_clause}",
34853485 if parent == ItemType :: Trait { " " } else { "" } ,
@@ -3526,7 +3526,7 @@ fn item_struct(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
35263526 s : & clean:: Struct ) -> fmt:: Result {
35273527 wrap_into_docblock ( w, |w| {
35283528 write ! ( w, "<pre class='rust struct'>" ) ?;
3529- render_attributes ( w, it) ?;
3529+ render_attributes ( w, it, true ) ?;
35303530 render_struct ( w,
35313531 it,
35323532 Some ( & s. generics ) ,
@@ -3577,7 +3577,7 @@ fn item_union(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
35773577 s : & clean:: Union ) -> fmt:: Result {
35783578 wrap_into_docblock ( w, |w| {
35793579 write ! ( w, "<pre class='rust union'>" ) ?;
3580- render_attributes ( w, it) ?;
3580+ render_attributes ( w, it, true ) ?;
35813581 render_union ( w,
35823582 it,
35833583 Some ( & s. generics ) ,
@@ -3622,7 +3622,7 @@ fn item_enum(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
36223622 e : & clean:: Enum ) -> fmt:: Result {
36233623 wrap_into_docblock ( w, |w| {
36243624 write ! ( w, "<pre class='rust enum'>" ) ?;
3625- render_attributes ( w, it) ?;
3625+ render_attributes ( w, it, true ) ?;
36263626 write ! ( w, "{}enum {}{}{}" ,
36273627 VisSpace ( & it. visibility) ,
36283628 it. name. as_ref( ) . unwrap( ) ,
@@ -3783,7 +3783,7 @@ const ATTRIBUTE_WHITELIST: &'static [&'static str] = &[
37833783 "non_exhaustive"
37843784] ;
37853785
3786- fn render_attributes ( w : & mut dyn fmt:: Write , it : & clean:: Item ) -> fmt:: Result {
3786+ fn render_attributes ( w : & mut dyn fmt:: Write , it : & clean:: Item , top : bool ) -> fmt:: Result {
37873787 let mut attrs = String :: new ( ) ;
37883788
37893789 for attr in & it. attrs . other_attrs {
@@ -3795,7 +3795,8 @@ fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item) -> fmt::Result {
37953795 }
37963796 }
37973797 if attrs. len ( ) > 0 {
3798- write ! ( w, "<div class=\" docblock attributes\" >{}</div>" , & attrs) ?;
3798+ write ! ( w, "<div class=\" docblock attributes{}\" >{}</div>" ,
3799+ if top { " top-attr" } else { "" } , & attrs) ?;
37993800 }
38003801 Ok ( ( ) )
38013802}
@@ -4344,7 +4345,7 @@ fn item_existential(
43444345 t : & clean:: Existential ,
43454346) -> fmt:: Result {
43464347 write ! ( w, "<pre class='rust existential'>" ) ?;
4347- render_attributes ( w, it) ?;
4348+ render_attributes ( w, it, false ) ?;
43484349 write ! ( w, "existential type {}{}{where_clause}: {bounds};</pre>" ,
43494350 it. name. as_ref( ) . unwrap( ) ,
43504351 t. generics,
@@ -4363,7 +4364,7 @@ fn item_existential(
43634364fn item_trait_alias ( w : & mut fmt:: Formatter < ' _ > , cx : & Context , it : & clean:: Item ,
43644365 t : & clean:: TraitAlias ) -> fmt:: Result {
43654366 write ! ( w, "<pre class='rust trait-alias'>" ) ?;
4366- render_attributes ( w, it) ?;
4367+ render_attributes ( w, it, false ) ?;
43674368 write ! ( w, "trait {}{}{} = {};</pre>" ,
43684369 it. name. as_ref( ) . unwrap( ) ,
43694370 t. generics,
@@ -4382,7 +4383,7 @@ fn item_trait_alias(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
43824383fn item_typedef ( w : & mut fmt:: Formatter < ' _ > , cx : & Context , it : & clean:: Item ,
43834384 t : & clean:: Typedef ) -> fmt:: Result {
43844385 write ! ( w, "<pre class='rust typedef'>" ) ?;
4385- render_attributes ( w, it) ?;
4386+ render_attributes ( w, it, false ) ?;
43864387 write ! ( w, "type {}{}{where_clause} = {type_};</pre>" ,
43874388 it. name. as_ref( ) . unwrap( ) ,
43884389 t. generics,
@@ -4400,7 +4401,7 @@ fn item_typedef(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item,
44004401
44014402fn item_foreign_type ( w : & mut fmt:: Formatter < ' _ > , cx : & Context , it : & clean:: Item ) -> fmt:: Result {
44024403 writeln ! ( w, "<pre class='rust foreigntype'>extern {{" ) ?;
4403- render_attributes ( w, it) ?;
4404+ render_attributes ( w, it, false ) ?;
44044405 write ! (
44054406 w,
44064407 " {}type {};\n }}</pre>" ,
0 commit comments