File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -3134,15 +3134,19 @@ class DocSearch {
31343134 * @param {boolean } isAssocType
31353135 */
31363136 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 ;
31403141 } else if ( ! parsedQuery . literalSearch ) {
31413142 let match = null ;
31423143 let matchDist = maxEditDistance + 1 ;
31433144 let matchName = "" ;
31443145 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+ ) ;
31463150 if ( dist <= matchDist && dist <= maxEditDistance &&
31473151 ( isAssocType || ! assocOnly ) ) {
31483152 if ( dist === matchDist && matchName > name ) {
You can’t perform that action at this time.
0 commit comments