File tree 1 file changed +8
-4
lines changed
src/librustdoc/html/static/js
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -3134,15 +3134,19 @@ class DocSearch {
3134
3134
* @param {boolean } isAssocType
3135
3135
*/
3136
3136
const convertNameToId = ( elem , isAssocType ) => {
3137
- if ( this . typeNameIdMap . has ( elem . normalizedPathLast ) &&
3138
- ( isAssocType || ! this . typeNameIdMap . get ( elem . normalizedPathLast ) . assocOnly ) ) {
3139
- elem . id = this . typeNameIdMap . get ( elem . normalizedPathLast ) . id ;
3137
+ const loweredName = elem . pathLast . toLowerCase ( ) ;
3138
+ if ( typeNameIdMap . has ( loweredName ) &&
3139
+ ( isAssocType || ! typeNameIdMap . get ( loweredName ) . assocOnly ) ) {
3140
+ elem . id = typeNameIdMap . get ( loweredName ) . id ;
3140
3141
} else if ( ! parsedQuery . literalSearch ) {
3141
3142
let match = null ;
3142
3143
let matchDist = maxEditDistance + 1 ;
3143
3144
let matchName = "" ;
3144
3145
for ( const [ name , { id, assocOnly } ] of this . typeNameIdMap ) {
3145
- const dist = editDistance ( name , elem . normalizedPathLast , maxEditDistance ) ;
3146
+ const dist = Math . min (
3147
+ editDistance ( name , loweredName , maxEditDistance ) ,
3148
+ editDistance ( name , elem . normalizedPathLast , maxEditDistance ) ,
3149
+ ) ;
3146
3150
if ( dist <= matchDist && dist <= maxEditDistance &&
3147
3151
( isAssocType || ! assocOnly ) ) {
3148
3152
if ( dist === matchDist && matchName > name ) {
You can’t perform that action at this time.
0 commit comments