@@ -4067,9 +4067,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
4067
4067
. filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
4068
4068
. flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false ) )
4069
4069
. collect :: < Vec < _ > > ( ) ;
4070
- // We want links' order to be reproducible so we don't use unstable sort.
4071
- ret. sort ( ) ;
4072
4070
if !ret. is_empty ( ) {
4071
+ // We want links' order to be reproducible so we don't use unstable sort.
4072
+ ret. sort ( ) ;
4073
4073
out. push_str ( & format ! (
4074
4074
"<a class=\" sidebar-title\" href=\" #implementations\" >Methods</a>\
4075
4075
<div class=\" sidebar-links\" >{}</div>",
@@ -4240,7 +4240,7 @@ fn is_negative_impl(i: &clean::Impl) -> bool {
4240
4240
fn sidebar_trait ( buf : & mut Buffer , it : & clean:: Item , t : & clean:: Trait ) {
4241
4241
let mut sidebar = String :: new ( ) ;
4242
4242
4243
- let types = t
4243
+ let mut types = t
4244
4244
. items
4245
4245
. iter ( )
4246
4246
. filter_map ( |m| match m. name {
@@ -4249,8 +4249,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4249
4249
}
4250
4250
_ => None ,
4251
4251
} )
4252
- . collect :: < String > ( ) ;
4253
- let consts = t
4252
+ . collect :: < Vec < _ > > ( ) ;
4253
+ let mut consts = t
4254
4254
. items
4255
4255
. iter ( )
4256
4256
. filter_map ( |m| match m. name {
@@ -4259,7 +4259,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4259
4259
}
4260
4260
_ => None ,
4261
4261
} )
4262
- . collect :: < String > ( ) ;
4262
+ . collect :: < Vec < _ > > ( ) ;
4263
4263
let mut required = t
4264
4264
. items
4265
4265
. iter ( )
@@ -4282,32 +4282,34 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4282
4282
. collect :: < Vec < String > > ( ) ;
4283
4283
4284
4284
if !types. is_empty ( ) {
4285
+ types. sort ( ) ;
4285
4286
sidebar. push_str ( & format ! (
4286
4287
"<a class=\" sidebar-title\" href=\" #associated-types\" >\
4287
- Associated Types</a><div class=\" sidebar-links\" >{}</div>",
4288
- types
4288
+ Associated Types</a><div class=\" sidebar-links\" >{}</div>",
4289
+ types. join ( "" )
4289
4290
) ) ;
4290
4291
}
4291
4292
if !consts. is_empty ( ) {
4293
+ consts. sort ( ) ;
4292
4294
sidebar. push_str ( & format ! (
4293
4295
"<a class=\" sidebar-title\" href=\" #associated-const\" >\
4294
- Associated Constants</a><div class=\" sidebar-links\" >{}</div>",
4295
- consts
4296
+ Associated Constants</a><div class=\" sidebar-links\" >{}</div>",
4297
+ consts. join ( "" )
4296
4298
) ) ;
4297
4299
}
4298
4300
if !required. is_empty ( ) {
4299
4301
required. sort ( ) ;
4300
4302
sidebar. push_str ( & format ! (
4301
4303
"<a class=\" sidebar-title\" href=\" #required-methods\" >\
4302
- Required Methods</a><div class=\" sidebar-links\" >{}</div>",
4304
+ Required Methods</a><div class=\" sidebar-links\" >{}</div>",
4303
4305
required. join( "" )
4304
4306
) ) ;
4305
4307
}
4306
4308
if !provided. is_empty ( ) {
4307
4309
provided. sort ( ) ;
4308
4310
sidebar. push_str ( & format ! (
4309
4311
"<a class=\" sidebar-title\" href=\" #provided-methods\" >\
4310
- Provided Methods</a><div class=\" sidebar-links\" >{}</div>",
4312
+ Provided Methods</a><div class=\" sidebar-links\" >{}</div>",
4311
4313
provided. join( "" )
4312
4314
) ) ;
4313
4315
}
@@ -4325,8 +4327,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4325
4327
res. sort ( ) ;
4326
4328
sidebar. push_str ( & format ! (
4327
4329
"<a class=\" sidebar-title\" href=\" #foreign-impls\" >\
4328
- Implementations on Foreign Types</a><div \
4329
- class=\" sidebar-links\" >{}</div>",
4330
+ Implementations on Foreign Types</a><div \
4331
+ class=\" sidebar-links\" >{}</div>",
4330
4332
res. into_iter( )
4331
4333
. map( |( name, id) | format!( "<a href=\" #{}\" >{}</a>" , id, Escape ( & name) ) )
4332
4334
. collect:: <Vec <_>>( )
@@ -4339,7 +4341,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
4339
4341
if t. auto {
4340
4342
sidebar. push_str (
4341
4343
"<a class=\" sidebar-title\" \
4342
- href=\" #synthetic-implementors\" >Auto Implementors</a>",
4344
+ href=\" #synthetic-implementors\" >Auto Implementors</a>",
4343
4345
) ;
4344
4346
}
4345
4347
@@ -4365,18 +4367,18 @@ fn sidebar_typedef(buf: &mut Buffer, it: &clean::Item) {
4365
4367
}
4366
4368
4367
4369
fn get_struct_fields_name ( fields : & [ clean:: Item ] ) -> String {
4368
- fields
4370
+ let mut fields = fields
4369
4371
. iter ( )
4370
4372
. filter ( |f| if let clean:: StructFieldItem ( ..) = f. inner { true } else { false } )
4371
4373
. filter_map ( |f| match f. name {
4372
- Some ( ref name) => Some ( format ! (
4373
- "<a href=\" #structfield.{name}\" >\
4374
- {name}</a>",
4375
- name = name
4376
- ) ) ,
4374
+ Some ( ref name) => {
4375
+ Some ( format ! ( "<a href=\" #structfield.{name}\" >{name}</a>" , name = name) )
4376
+ }
4377
4377
_ => None ,
4378
4378
} )
4379
- . collect ( )
4379
+ . collect :: < Vec < _ > > ( ) ;
4380
+ fields. sort ( ) ;
4381
+ fields. join ( "" )
4380
4382
}
4381
4383
4382
4384
fn sidebar_union ( buf : & mut Buffer , it : & clean:: Item , u : & clean:: Union ) {
@@ -4386,7 +4388,7 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
4386
4388
if !fields. is_empty ( ) {
4387
4389
sidebar. push_str ( & format ! (
4388
4390
"<a class=\" sidebar-title\" href=\" #fields\" >Fields</a>\
4389
- <div class=\" sidebar-links\" >{}</div>",
4391
+ <div class=\" sidebar-links\" >{}</div>",
4390
4392
fields
4391
4393
) ) ;
4392
4394
}
@@ -4401,23 +4403,20 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
4401
4403
fn sidebar_enum ( buf : & mut Buffer , it : & clean:: Item , e : & clean:: Enum ) {
4402
4404
let mut sidebar = String :: new ( ) ;
4403
4405
4404
- let variants = e
4406
+ let mut variants = e
4405
4407
. variants
4406
4408
. iter ( )
4407
4409
. filter_map ( |v| match v. name {
4408
- Some ( ref name) => Some ( format ! (
4409
- "<a href=\" #variant.{name}\" >{name}\
4410
- </a>",
4411
- name = name
4412
- ) ) ,
4410
+ Some ( ref name) => Some ( format ! ( "<a href=\" #variant.{name}\" >{name}</a>" , name = name) ) ,
4413
4411
_ => None ,
4414
4412
} )
4415
- . collect :: < String > ( ) ;
4413
+ . collect :: < Vec < _ > > ( ) ;
4416
4414
if !variants. is_empty ( ) {
4415
+ variants. sort_unstable ( ) ;
4417
4416
sidebar. push_str ( & format ! (
4418
4417
"<a class=\" sidebar-title\" href=\" #variants\" >Variants</a>\
4419
- <div class=\" sidebar-links\" >{}</div>",
4420
- variants
4418
+ <div class=\" sidebar-links\" >{}</div>",
4419
+ variants. join ( "" ) ,
4421
4420
) ) ;
4422
4421
}
4423
4422
0 commit comments