File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change 681681 }
682682
683683 function checkPath ( startsWith , lastElem , ty ) {
684+ if ( startsWith . length === 0 ) {
685+ return 0 ;
686+ }
684687 var ret_lev = MAX_LEV_DISTANCE + 1 ;
685688 var path = ty . path . split ( "::" ) ;
686689
706709 lev_total += lev ;
707710 }
708711 if ( aborted === false ) {
709- var extra = MAX_LEV_DISTANCE + 1 ;
710- if ( i + startsWith . length < path . length ) {
711- extra = levenshtein ( path [ i + startsWith . length ] , lastElem ) ;
712- }
713- if ( extra > MAX_LEV_DISTANCE ) {
714- extra = levenshtein ( ty . name , lastElem ) ;
715- }
716- if ( extra < MAX_LEV_DISTANCE + 1 ) {
717- lev_total += extra ;
718- ret_lev = Math . min ( ret_lev ,
719- Math . round ( lev_total / ( startsWith . length + 1 ) ) ) ;
720- }
712+ ret_lev = Math . min ( ret_lev , Math . round ( lev_total / startsWith . length ) ) ;
721713 }
722714 }
723715 return ret_lev ;
934926 }
935927
936928 lev += lev_add ;
929+ if ( lev > 0 && val . length > 3 && searchWords [ j ] . startsWith ( val ) ) {
930+ if ( val . length < 6 ) {
931+ lev -= 1 ;
932+ } else {
933+ lev = 0 ;
934+ }
935+ }
937936 if ( in_args <= MAX_LEV_DISTANCE ) {
938937 if ( results_in_args [ fullId ] === undefined ) {
939938 results_in_args [ fullId ] = {
You can’t perform that action at this time.
0 commit comments