@@ -898,44 +898,44 @@ fn item_module(w: &mut Writer, cx: &Context,
898
898
debug ! ( "{:?}" , items) ;
899
899
let mut indices = vec:: from_fn ( items. len ( ) , |i| i) ;
900
900
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 {
902
902
if shortty ( i1) == shortty ( i2) {
903
- return i1. name <= i2. name ;
903
+ return i1. name . cmp ( & i2. name ) ;
904
904
}
905
905
match ( & i1. inner , & i2. inner ) {
906
906
( & clean:: ViewItemItem ( ref a) , & clean:: ViewItemItem ( ref b) ) => {
907
907
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) ,
911
911
}
912
912
}
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) ,
934
934
}
935
935
}
936
936
937
937
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) ) ;
939
939
940
940
debug ! ( "{:?}" , indices) ;
941
941
let mut curty = "" ;
@@ -1530,7 +1530,7 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
1530
1530
}
1531
1531
1532
1532
for ( _, items) in map. mut_iter ( ) {
1533
- items. sort ( |i1 , i2| i1 <= i2 ) ;
1533
+ items. sort ( ) ;
1534
1534
}
1535
1535
return map;
1536
1536
}
0 commit comments