@@ -2141,7 +2141,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21412141
21422142 if !types. is_empty ( ) {
21432143 write ! ( w, "
2144- <h2 id='associated-types'>Associated Types</h2>
2144+ <h2 id='associated-types' class='section-header'>
2145+ <a href='#associated-types'>Associated Types</a>
2146+ </h2>
21452147 <div class='methods'>
21462148 " ) ?;
21472149 for t in & types {
@@ -2152,7 +2154,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21522154
21532155 if !consts. is_empty ( ) {
21542156 write ! ( w, "
2155- <h2 id='associated-const'>Associated Constants</h2>
2157+ <h2 id='associated-const' class='section-header'>
2158+ <a href='#associated-const'>Associated Constants</a>
2159+ </h2>
21562160 <div class='methods'>
21572161 " ) ?;
21582162 for t in & consts {
@@ -2164,7 +2168,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21642168 // Output the documentation for each function individually
21652169 if !required. is_empty ( ) {
21662170 write ! ( w, "
2167- <h2 id='required-methods'>Required Methods</h2>
2171+ <h2 id='required-methods' class='section-header'>
2172+ <a href='#required-methods'>Required Methods</a>
2173+ </h2>
21682174 <div class='methods'>
21692175 " ) ?;
21702176 for m in & required {
@@ -2174,7 +2180,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21742180 }
21752181 if !provided. is_empty ( ) {
21762182 write ! ( w, "
2177- <h2 id='provided-methods'>Provided Methods</h2>
2183+ <h2 id='provided-methods' class='section-header'>
2184+ <a href='#provided-methods'>Provided Methods</a>
2185+ </h2>
21782186 <div class='methods'>
21792187 " ) ?;
21802188 for m in & provided {
@@ -2188,7 +2196,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21882196
21892197 let cache = cache ( ) ;
21902198 write ! ( w, "
2191- <h2 id='implementors'>Implementors</h2>
2199+ <h2 id='implementors' class='section-header'>
2200+ <a href='#implementors'>Implementors</a>
2201+ </h2>
21922202 <ul class='item-list' id='implementors-list'>
21932203 " ) ?;
21942204 if let Some ( implementors) = cache. implementors . get ( & it. def_id ) {
@@ -2419,7 +2429,8 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
24192429 } ) . peekable ( ) ;
24202430 if let doctree:: Plain = s. struct_type {
24212431 if fields. peek ( ) . is_some ( ) {
2422- write ! ( w, "<h2 id='fields' class='fields'>Fields</h2>" ) ?;
2432+ write ! ( w, "<h2 id='fields' class='fields section-header'>
2433+ <a href='#fields'>Fields</a></h2>" ) ?;
24232434 for ( field, ty) in fields {
24242435 let id = derive_id ( format ! ( "{}.{}" ,
24252436 ItemType :: StructField ,
@@ -2467,7 +2478,8 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
24672478 }
24682479 } ) . peekable ( ) ;
24692480 if fields. peek ( ) . is_some ( ) {
2470- write ! ( w, "<h2 id='fields' class='fields'>Fields</h2>" ) ?;
2481+ write ! ( w, "<h2 id='fields' class='fields section-header'>
2482+ <a href='#fields'>Fields</a></h2>" ) ?;
24712483 for ( field, ty) in fields {
24722484 write ! ( w, "<span id='{shortty}.{name}' class=\" {shortty}\" ><code>{name}: {ty}</code>
24732485 </span>" ,
@@ -2539,7 +2551,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
25392551
25402552 document ( w, cx, it) ?;
25412553 if !e. variants . is_empty ( ) {
2542- write ! ( w, "<h2 id='variants' class='variants'>Variants</h2>\n " ) ?;
2554+ write ! ( w, "<h2 id='variants' class='variants section-header'>
2555+ <a href='#variants'>Variants</a></h2>\n " ) ?;
25432556 for variant in & e. variants {
25442557 let id = derive_id ( format ! ( "{}.{}" ,
25452558 ItemType :: Variant ,
@@ -2810,12 +2823,19 @@ fn render_assoc_items(w: &mut fmt::Formatter,
28102823 if !non_trait. is_empty ( ) {
28112824 let render_mode = match what {
28122825 AssocItemRender :: All => {
2813- write ! ( w, "<h2 id='methods'>Methods</h2>" ) ?;
2826+ write ! ( w, "
2827+ <h2 id='methods' class='section-header'>
2828+ <a href='#methods'>Methods</a>
2829+ </h2>
2830+ " ) ?;
28142831 RenderMode :: Normal
28152832 }
28162833 AssocItemRender :: DerefFor { trait_, type_, deref_mut_ } => {
2817- write ! ( w, "<h2 id='deref-methods'>Methods from \
2818- {}<Target = {}></h2>", trait_, type_) ?;
2834+ write ! ( w, "
2835+ <h2 id='deref-methods' class='section-header'>
2836+ <a href='#deref-methods'>Methods from {}<Target = {}></a>
2837+ </h2>
2838+ " , trait_, type_) ?;
28192839 RenderMode :: ForDeref { mut_ : deref_mut_ }
28202840 }
28212841 } ;
@@ -2837,8 +2857,11 @@ fn render_assoc_items(w: &mut fmt::Formatter,
28372857 } ) . is_some ( ) ;
28382858 render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut) ?;
28392859 }
2840- write ! ( w, "<h2 id='implementations'>Trait \
2841- Implementations</h2>") ?;
2860+ write ! ( w, "
2861+ <h2 id='implementations' class='section-header'>
2862+ <a href='#implementations'>Trait Implementations</a>
2863+ </h2>
2864+ " ) ?;
28422865 for i in & traits {
28432866 let did = i. trait_did ( ) . unwrap ( ) ;
28442867 let assoc_link = AssocItemLink :: GotoSource ( did, & i. inner_impl ( ) . provided_trait_methods ) ;
0 commit comments