@@ -898,44 +898,44 @@ fn item_module(w: &mut Writer, cx: &Context,
898898 debug ! ( "{:?}" , items) ;
899899 let mut indices = vec:: from_fn ( items. len ( ) , |i| i) ;
900900
901- fn le ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> bool {
901+ fn cmp ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> Ordering {
902902 if shortty ( i1) == shortty ( i2) {
903- return i1. name <= i2. name ;
903+ return i1. name . cmp ( & i2. name ) ;
904904 }
905905 match ( & i1. inner , & i2. inner ) {
906906 ( & clean:: ViewItemItem ( ref a) , & clean:: ViewItemItem ( ref b) ) => {
907907 match ( & a. inner , & b. inner ) {
908- ( & clean:: ExternMod ( ..) , _) => true ,
909- ( _, & clean:: ExternMod ( ..) ) => false ,
910- _ => idx1 <= idx2,
908+ ( & clean:: ExternMod ( ..) , _) => Less ,
909+ ( _, & clean:: ExternMod ( ..) ) => Greater ,
910+ _ => idx1. cmp ( & idx2) ,
911911 }
912912 }
913- ( & clean:: ViewItemItem ( ..) , _) => true ,
914- ( _, & clean:: ViewItemItem ( ..) ) => false ,
915- ( & clean:: ModuleItem ( ..) , _) => true ,
916- ( _, & clean:: ModuleItem ( ..) ) => false ,
917- ( & clean:: StructItem ( ..) , _) => true ,
918- ( _, & clean:: StructItem ( ..) ) => false ,
919- ( & clean:: EnumItem ( ..) , _) => true ,
920- ( _, & clean:: EnumItem ( ..) ) => false ,
921- ( & clean:: StaticItem ( ..) , _) => true ,
922- ( _, & clean:: StaticItem ( ..) ) => false ,
923- ( & clean:: ForeignFunctionItem ( ..) , _) => true ,
924- ( _, & clean:: ForeignFunctionItem ( ..) ) => false ,
925- ( & clean:: ForeignStaticItem ( ..) , _) => true ,
926- ( _, & clean:: ForeignStaticItem ( ..) ) => false ,
927- ( & clean:: TraitItem ( ..) , _) => true ,
928- ( _, & clean:: TraitItem ( ..) ) => false ,
929- ( & clean:: FunctionItem ( ..) , _) => true ,
930- ( _, & clean:: FunctionItem ( ..) ) => false ,
931- ( & clean:: TypedefItem ( ..) , _) => true ,
932- ( _, & clean:: TypedefItem ( ..) ) => false ,
933- _ => idx1 <= idx2,
913+ ( & clean:: ViewItemItem ( ..) , _) => Less ,
914+ ( _, & clean:: ViewItemItem ( ..) ) => Greater ,
915+ ( & clean:: ModuleItem ( ..) , _) => Less ,
916+ ( _, & clean:: ModuleItem ( ..) ) => Greater ,
917+ ( & clean:: StructItem ( ..) , _) => Less ,
918+ ( _, & clean:: StructItem ( ..) ) => Greater ,
919+ ( & clean:: EnumItem ( ..) , _) => Less ,
920+ ( _, & clean:: EnumItem ( ..) ) => Greater ,
921+ ( & clean:: StaticItem ( ..) , _) => Less ,
922+ ( _, & clean:: StaticItem ( ..) ) => Greater ,
923+ ( & clean:: ForeignFunctionItem ( ..) , _) => Less ,
924+ ( _, & clean:: ForeignFunctionItem ( ..) ) => Greater ,
925+ ( & clean:: ForeignStaticItem ( ..) , _) => Less ,
926+ ( _, & clean:: ForeignStaticItem ( ..) ) => Greater ,
927+ ( & clean:: TraitItem ( ..) , _) => Less ,
928+ ( _, & clean:: TraitItem ( ..) ) => Greater ,
929+ ( & clean:: FunctionItem ( ..) , _) => Less ,
930+ ( _, & clean:: FunctionItem ( ..) ) => Greater ,
931+ ( & clean:: TypedefItem ( ..) , _) => Less ,
932+ ( _, & clean:: TypedefItem ( ..) ) => Greater ,
933+ _ => idx1. cmp ( & idx2) ,
934934 }
935935 }
936936
937937 debug ! ( "{:?}" , indices) ;
938- indices. sort_by ( |& i1, & i2| le ( & items[ i1] , & items[ i2] , i1, i2) ) ;
938+ indices. sort_by ( |& i1, & i2| cmp ( & items[ i1] , & items[ i2] , i1, i2) ) ;
939939
940940 debug ! ( "{:?}" , indices) ;
941941 let mut curty = "" ;
@@ -1530,7 +1530,7 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
15301530 }
15311531
15321532 for ( _, items) in map. mut_iter ( ) {
1533- items. sort ( |i1 , i2| i1 <= i2 ) ;
1533+ items. sort ( ) ;
15341534 }
15351535 return map;
15361536}
0 commit comments