@@ -4064,9 +4064,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
4064
4064
. filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
4065
4065
. flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false ) )
4066
4066
. collect :: < Vec < _ > > ( ) ;
4067
- // We want links' order to be reproducible so we don't use unstable sort.
4068
- ret. sort ( ) ;
4069
4067
if !ret. is_empty ( ) {
4068
+ // We want links' order to be reproducible so we don't use unstable sort.
4069
+ ret. sort ( ) ;
4070
4070
out. push_str ( & format ! (
4071
4071
"<a class=\" sidebar-title\" href=\" #implementations\" >Methods</a>\
4072
4072
<div class=\" sidebar-links\" >{}</div>",
@@ -4237,7 +4237,7 @@ fn is_negative_impl(i: &clean::Impl) -> bool {
4237
4237
fn sidebar_trait ( buf : & mut Buffer , it : & clean:: Item , t : & clean:: Trait ) {
4238
4238
let mut sidebar = String :: new ( ) ;
4239
4239
4240
- let types = t
4240
+ let mut types = t
4241
4241
. items
4242
4242
. iter ( )
4243
4243
. filter_map ( |m| match m. name {
@@ -4246,8 +4246,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4246
4246
}
4247
4247
_ => None ,
4248
4248
} )
4249
- . collect :: < String > ( ) ;
4250
- let consts = t
4249
+ . collect :: < Vec < _ > > ( ) ;
4250
+ let mut consts = t
4251
4251
. items
4252
4252
. iter ( )
4253
4253
. filter_map ( |m| match m. name {
@@ -4256,7 +4256,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4256
4256
}
4257
4257
_ => None ,
4258
4258
} )
4259
- . collect :: < String > ( ) ;
4259
+ . collect :: < Vec < _ > > ( ) ;
4260
4260
let mut required = t
4261
4261
. items
4262
4262
. iter ( )
@@ -4279,32 +4279,34 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4279
4279
. collect :: < Vec < String > > ( ) ;
4280
4280
4281
4281
if !types. is_empty ( ) {
4282
+ types. sort ( ) ;
4282
4283
sidebar. push_str ( & format ! (
4283
4284
"<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 ( "" )
4286
4287
) ) ;
4287
4288
}
4288
4289
if !consts. is_empty ( ) {
4290
+ consts. sort ( ) ;
4289
4291
sidebar. push_str ( & format ! (
4290
4292
"<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 ( "" )
4293
4295
) ) ;
4294
4296
}
4295
4297
if !required. is_empty ( ) {
4296
4298
required. sort ( ) ;
4297
4299
sidebar. push_str ( & format ! (
4298
4300
"<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>",
4300
4302
required. join( "" )
4301
4303
) ) ;
4302
4304
}
4303
4305
if !provided. is_empty ( ) {
4304
4306
provided. sort ( ) ;
4305
4307
sidebar. push_str ( & format ! (
4306
4308
"<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>",
4308
4310
provided. join( "" )
4309
4311
) ) ;
4310
4312
}
@@ -4322,8 +4324,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4322
4324
res. sort ( ) ;
4323
4325
sidebar. push_str ( & format ! (
4324
4326
"<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>",
4327
4329
res. into_iter( )
4328
4330
. map( |( name, id) | format!( "<a href=\" #{}\" >{}</a>" , id, Escape ( & name) ) )
4329
4331
. collect:: <Vec <_>>( )
@@ -4336,7 +4338,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4336
4338
if t. auto {
4337
4339
sidebar. push_str (
4338
4340
"<a class=\" sidebar-title\" \
4339
- href=\" #synthetic-implementors\" >Auto Implementors</a>",
4341
+ href=\" #synthetic-implementors\" >Auto Implementors</a>",
4340
4342
) ;
4341
4343
}
4342
4344
@@ -4362,18 +4364,18 @@ fn sidebar_typedef(buf: &mut Buffer, it: &clean::Item) {
4362
4364
}
4363
4365
4364
4366
fn get_struct_fields_name ( fields : & [ clean:: Item ] ) -> String {
4365
- fields
4367
+ let mut fields = fields
4366
4368
. iter ( )
4367
4369
. filter ( |f| if let clean:: StructFieldItem ( ..) = f. inner { true } else { false } )
4368
4370
. 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
+ }
4374
4374
_ => None ,
4375
4375
} )
4376
- . collect ( )
4376
+ . collect :: < Vec < _ > > ( ) ;
4377
+ fields. sort ( ) ;
4378
+ fields. join ( "" )
4377
4379
}
4378
4380
4379
4381
fn 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) {
4383
4385
if !fields. is_empty ( ) {
4384
4386
sidebar. push_str ( & format ! (
4385
4387
"<a class=\" sidebar-title\" href=\" #fields\" >Fields</a>\
4386
- <div class=\" sidebar-links\" >{}</div>",
4388
+ <div class=\" sidebar-links\" >{}</div>",
4387
4389
fields
4388
4390
) ) ;
4389
4391
}
@@ -4398,23 +4400,20 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
4398
4400
fn sidebar_enum ( buf : & mut Buffer , it : & clean:: Item , e : & clean:: Enum ) {
4399
4401
let mut sidebar = String :: new ( ) ;
4400
4402
4401
- let variants = e
4403
+ let mut variants = e
4402
4404
. variants
4403
4405
. iter ( )
4404
4406
. 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) ) ,
4410
4408
_ => None ,
4411
4409
} )
4412
- . collect :: < String > ( ) ;
4410
+ . collect :: < Vec < _ > > ( ) ;
4413
4411
if !variants. is_empty ( ) {
4412
+ variants. sort_unstable ( ) ;
4414
4413
sidebar. push_str ( & format ! (
4415
4414
"<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 ( "" ) ,
4418
4417
) ) ;
4419
4418
}
4420
4419
0 commit comments