@@ -4064,9 +4064,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
40644064 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
40654065 . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false ) )
40664066 . collect :: < Vec < _ > > ( ) ;
4067- // We want links' order to be reproducible so we don't use unstable sort.
4068- ret. sort ( ) ;
40694067 if !ret. is_empty ( ) {
4068+ // We want links' order to be reproducible so we don't use unstable sort.
4069+ ret. sort ( ) ;
40704070 out. push_str ( & format ! (
40714071 "<a class=\" sidebar-title\" href=\" #implementations\" >Methods</a>\
40724072 <div class=\" sidebar-links\" >{}</div>",
@@ -4237,7 +4237,7 @@ fn is_negative_impl(i: &clean::Impl) -> bool {
42374237fn sidebar_trait ( buf : & mut Buffer , it : & clean:: Item , t : & clean:: Trait ) {
42384238 let mut sidebar = String :: new ( ) ;
42394239
4240- let types = t
4240+ let mut types = t
42414241 . items
42424242 . iter ( )
42434243 . filter_map ( |m| match m. name {
@@ -4246,8 +4246,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42464246 }
42474247 _ => None ,
42484248 } )
4249- . collect :: < String > ( ) ;
4250- let consts = t
4249+ . collect :: < Vec < _ > > ( ) ;
4250+ let mut consts = t
42514251 . items
42524252 . iter ( )
42534253 . filter_map ( |m| match m. name {
@@ -4256,7 +4256,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42564256 }
42574257 _ => None ,
42584258 } )
4259- . collect :: < String > ( ) ;
4259+ . collect :: < Vec < _ > > ( ) ;
42604260 let mut required = t
42614261 . items
42624262 . iter ( )
@@ -4279,32 +4279,34 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42794279 . collect :: < Vec < String > > ( ) ;
42804280
42814281 if !types. is_empty ( ) {
4282+ types. sort ( ) ;
42824283 sidebar. push_str ( & format ! (
42834284 "<a class=\" sidebar-title\" href=\" #associated-types\" >\
4284- Associated Types</a><div class=\" sidebar-links\" >{}</div>",
4285- types
4285+ Associated Types</a><div class=\" sidebar-links\" >{}</div>",
4286+ types. join ( "" )
42864287 ) ) ;
42874288 }
42884289 if !consts. is_empty ( ) {
4290+ consts. sort ( ) ;
42894291 sidebar. push_str ( & format ! (
42904292 "<a class=\" sidebar-title\" href=\" #associated-const\" >\
4291- Associated Constants</a><div class=\" sidebar-links\" >{}</div>",
4292- consts
4293+ Associated Constants</a><div class=\" sidebar-links\" >{}</div>",
4294+ consts. join ( "" )
42934295 ) ) ;
42944296 }
42954297 if !required. is_empty ( ) {
42964298 required. sort ( ) ;
42974299 sidebar. push_str ( & format ! (
42984300 "<a class=\" sidebar-title\" href=\" #required-methods\" >\
4299- Required Methods</a><div class=\" sidebar-links\" >{}</div>",
4301+ Required Methods</a><div class=\" sidebar-links\" >{}</div>",
43004302 required. join( "" )
43014303 ) ) ;
43024304 }
43034305 if !provided. is_empty ( ) {
43044306 provided. sort ( ) ;
43054307 sidebar. push_str ( & format ! (
43064308 "<a class=\" sidebar-title\" href=\" #provided-methods\" >\
4307- Provided Methods</a><div class=\" sidebar-links\" >{}</div>",
4309+ Provided Methods</a><div class=\" sidebar-links\" >{}</div>",
43084310 provided. join( "" )
43094311 ) ) ;
43104312 }
@@ -4322,8 +4324,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
43224324 res. sort ( ) ;
43234325 sidebar. push_str ( & format ! (
43244326 "<a class=\" sidebar-title\" href=\" #foreign-impls\" >\
4325- Implementations on Foreign Types</a><div \
4326- class=\" sidebar-links\" >{}</div>",
4327+ Implementations on Foreign Types</a><div \
4328+ class=\" sidebar-links\" >{}</div>",
43274329 res. into_iter( )
43284330 . map( |( name, id) | format!( "<a href=\" #{}\" >{}</a>" , id, Escape ( & name) ) )
43294331 . collect:: <Vec <_>>( )
@@ -4336,7 +4338,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
43364338 if t. auto {
43374339 sidebar. push_str (
43384340 "<a class=\" sidebar-title\" \
4339- href=\" #synthetic-implementors\" >Auto Implementors</a>",
4341+ href=\" #synthetic-implementors\" >Auto Implementors</a>",
43404342 ) ;
43414343 }
43424344
@@ -4362,18 +4364,18 @@ fn sidebar_typedef(buf: &mut Buffer, it: &clean::Item) {
43624364}
43634365
43644366fn get_struct_fields_name ( fields : & [ clean:: Item ] ) -> String {
4365- fields
4367+ let mut fields = fields
43664368 . iter ( )
43674369 . filter ( |f| if let clean:: StructFieldItem ( ..) = f. inner { true } else { false } )
43684370 . filter_map ( |f| match f. name {
4369- Some ( ref name) => Some ( format ! (
4370- "<a href=\" #structfield.{name}\" >\
4371- {name}</a>",
4372- name = name
4373- ) ) ,
4371+ Some ( ref name) => {
4372+ Some ( format ! ( "<a href=\" #structfield.{name}\" >{name}</a>" , name = name) )
4373+ }
43744374 _ => None ,
43754375 } )
4376- . collect ( )
4376+ . collect :: < Vec < _ > > ( ) ;
4377+ fields. sort ( ) ;
4378+ fields. join ( "" )
43774379}
43784380
43794381fn sidebar_union ( buf : & mut Buffer , it : & clean:: Item , u : & clean:: Union ) {
@@ -4383,7 +4385,7 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
43834385 if !fields. is_empty ( ) {
43844386 sidebar. push_str ( & format ! (
43854387 "<a class=\" sidebar-title\" href=\" #fields\" >Fields</a>\
4386- <div class=\" sidebar-links\" >{}</div>",
4388+ <div class=\" sidebar-links\" >{}</div>",
43874389 fields
43884390 ) ) ;
43894391 }
@@ -4398,23 +4400,20 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
43984400fn sidebar_enum ( buf : & mut Buffer , it : & clean:: Item , e : & clean:: Enum ) {
43994401 let mut sidebar = String :: new ( ) ;
44004402
4401- let variants = e
4403+ let mut variants = e
44024404 . variants
44034405 . iter ( )
44044406 . filter_map ( |v| match v. name {
4405- Some ( ref name) => Some ( format ! (
4406- "<a href=\" #variant.{name}\" >{name}\
4407- </a>",
4408- name = name
4409- ) ) ,
4407+ Some ( ref name) => Some ( format ! ( "<a href=\" #variant.{name}\" >{name}</a>" , name = name) ) ,
44104408 _ => None ,
44114409 } )
4412- . collect :: < String > ( ) ;
4410+ . collect :: < Vec < _ > > ( ) ;
44134411 if !variants. is_empty ( ) {
4412+ variants. sort_unstable ( ) ;
44144413 sidebar. push_str ( & format ! (
44154414 "<a class=\" sidebar-title\" href=\" #variants\" >Variants</a>\
4416- <div class=\" sidebar-links\" >{}</div>",
4417- variants
4415+ <div class=\" sidebar-links\" >{}</div>",
4416+ variants. join ( "" ) ,
44184417 ) ) ;
44194418 }
44204419
0 commit comments