File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ const TY_PRIMITIVE = itemTypes.indexOf("primitive");
6363const TY_GENERIC = itemTypes . indexOf ( "generic" ) ;
6464const TY_IMPORT = itemTypes . indexOf ( "import" ) ;
6565const TY_TRAIT = itemTypes . indexOf ( "trait" ) ;
66+ const TY_FN = itemTypes . indexOf ( "fn" ) ;
6667const ROOT_PATH = typeof window !== "undefined" ? window . rootPath : "../" ;
6768
6869// Hard limit on how deep to recurse into generics when doing type-driven search.
@@ -2749,6 +2750,15 @@ class DocSearch {
27492750 return a - b ;
27502751 }
27512752
2753+ // in type based search, put functions first
2754+ if ( parsedQuery . hasReturnArrow ) {
2755+ a = ( aaa . item . ty !== TY_FN ) ;
2756+ b = ( bbb . item . ty !== TY_FN ) ;
2757+ if ( a !== b ) {
2758+ return a - b ;
2759+ }
2760+ }
2761+
27522762 // Sort by distance in the path part, if specified
27532763 // (less changes required to match means higher rankings)
27542764 a = aaa . path_dist ;
Original file line number Diff line number Diff line change 11const EXPECTED = {
22 'query' : '-> char' ,
33 'others' : [
4+ { 'path' : 'std::char' , 'name' : 'from_digit' } ,
45 { 'path' : 'std::char' , 'name' : 'MAX' } ,
56 ] ,
67}
You can’t perform that action at this time.
0 commit comments