@@ -4067,9 +4067,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
40674067 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
40684068 . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false ) )
40694069 . collect :: < Vec < _ > > ( ) ;
4070- // We want links' order to be reproducible so we don't use unstable sort.
4071- ret. sort ( ) ;
40724070 if !ret. is_empty ( ) {
4071+ // We want links' order to be reproducible so we don't use unstable sort.
4072+ ret. sort ( ) ;
40734073 out. push_str ( & format ! (
40744074 "<a class=\" sidebar-title\" href=\" #implementations\" >Methods</a>\
40754075 <div class=\" sidebar-links\" >{}</div>",
@@ -4240,7 +4240,7 @@ fn is_negative_impl(i: &clean::Impl) -> bool {
42404240fn sidebar_trait ( buf : & mut Buffer , it : & clean:: Item , t : & clean:: Trait ) {
42414241 let mut sidebar = String :: new ( ) ;
42424242
4243- let types = t
4243+ let mut types = t
42444244 . items
42454245 . iter ( )
42464246 . filter_map ( |m| match m. name {
@@ -4249,8 +4249,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42494249 }
42504250 _ => None ,
42514251 } )
4252- . collect :: < String > ( ) ;
4253- let consts = t
4252+ . collect :: < Vec < _ > > ( ) ;
4253+ let mut consts = t
42544254 . items
42554255 . iter ( )
42564256 . filter_map ( |m| match m. name {
@@ -4259,7 +4259,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42594259 }
42604260 _ => None ,
42614261 } )
4262- . collect :: < String > ( ) ;
4262+ . collect :: < Vec < _ > > ( ) ;
42634263 let mut required = t
42644264 . items
42654265 . iter ( )
@@ -4282,32 +4282,34 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
42824282 . collect :: < Vec < String > > ( ) ;
42834283
42844284 if !types. is_empty ( ) {
4285+ types. sort ( ) ;
42854286 sidebar. push_str ( & format ! (
42864287 "<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 ( "" )
42894290 ) ) ;
42904291 }
42914292 if !consts. is_empty ( ) {
4293+ consts. sort ( ) ;
42924294 sidebar. push_str ( & format ! (
42934295 "<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 ( "" )
42964298 ) ) ;
42974299 }
42984300 if !required. is_empty ( ) {
42994301 required. sort ( ) ;
43004302 sidebar. push_str ( & format ! (
43014303 "<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>",
43034305 required. join( "" )
43044306 ) ) ;
43054307 }
43064308 if !provided. is_empty ( ) {
43074309 provided. sort ( ) ;
43084310 sidebar. push_str ( & format ! (
43094311 "<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>",
43114313 provided. join( "" )
43124314 ) ) ;
43134315 }
@@ -4325,8 +4327,8 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
43254327 res. sort ( ) ;
43264328 sidebar. push_str ( & format ! (
43274329 "<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>",
43304332 res. into_iter( )
43314333 . map( |( name, id) | format!( "<a href=\" #{}\" >{}</a>" , id, Escape ( & name) ) )
43324334 . collect:: <Vec <_>>( )
@@ -4339,7 +4341,7 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
43394341 if t. auto {
43404342 sidebar. push_str (
43414343 "<a class=\" sidebar-title\" \
4342- href=\" #synthetic-implementors\" >Auto Implementors</a>",
4344+ href=\" #synthetic-implementors\" >Auto Implementors</a>",
43434345 ) ;
43444346 }
43454347
@@ -4365,18 +4367,18 @@ fn sidebar_typedef(buf: &mut Buffer, it: &clean::Item) {
43654367}
43664368
43674369fn get_struct_fields_name ( fields : & [ clean:: Item ] ) -> String {
4368- fields
4370+ let mut fields = fields
43694371 . iter ( )
43704372 . filter ( |f| if let clean:: StructFieldItem ( ..) = f. inner { true } else { false } )
43714373 . 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+ }
43774377 _ => None ,
43784378 } )
4379- . collect ( )
4379+ . collect :: < Vec < _ > > ( ) ;
4380+ fields. sort ( ) ;
4381+ fields. join ( "" )
43804382}
43814383
43824384fn 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) {
43864388 if !fields. is_empty ( ) {
43874389 sidebar. push_str ( & format ! (
43884390 "<a class=\" sidebar-title\" href=\" #fields\" >Fields</a>\
4389- <div class=\" sidebar-links\" >{}</div>",
4391+ <div class=\" sidebar-links\" >{}</div>",
43904392 fields
43914393 ) ) ;
43924394 }
@@ -4401,23 +4403,20 @@ fn sidebar_union(buf: &mut Buffer, it: &clean::Item, u: &clean::Union) {
44014403fn sidebar_enum ( buf : & mut Buffer , it : & clean:: Item , e : & clean:: Enum ) {
44024404 let mut sidebar = String :: new ( ) ;
44034405
4404- let variants = e
4406+ let mut variants = e
44054407 . variants
44064408 . iter ( )
44074409 . 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) ) ,
44134411 _ => None ,
44144412 } )
4415- . collect :: < String > ( ) ;
4413+ . collect :: < Vec < _ > > ( ) ;
44164414 if !variants. is_empty ( ) {
4415+ variants. sort_unstable ( ) ;
44174416 sidebar. push_str ( & format ! (
44184417 "<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 ( "" ) ,
44214420 ) ) ;
44224421 }
44234422
0 commit comments