File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed 
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3639,7 +3639,7 @@ class DocSearch {
36393639            if  ( contains . length  ===  0 )  { 
36403640                return  0 ; 
36413641            } 
3642-             const  maxPathEditDistance  =  Math . floor ( 
3642+             const  maxPathEditDistance  =  parsedQuery . literalSearch  ?  0  :  Math . floor ( 
36433643                contains . reduce ( ( acc ,  next )  =>  acc  +  next . length ,  0 )  /  3 , 
36443644            ) ; 
36453645            let  ret_dist  =  maxPathEditDistance  +  1 ; 
@@ -3650,7 +3650,9 @@ class DocSearch {
36503650                let  dist_total  =  0 ; 
36513651                for  ( let  x  =  0 ;  x  <  clength ;  ++ x )  { 
36523652                    const  [ p ,  c ]  =  [ path [ i  +  x ] ,  contains [ x ] ] ; 
3653-                     if  ( Math . floor ( ( p . length  -  c . length )  /  3 )  <=  maxPathEditDistance  && 
3653+                     if  ( parsedQuery . literalSearch  &&  p  !==  c )  { 
3654+                         continue  pathiter; 
3655+                     }  else  if  ( Math . floor ( ( p . length  -  c . length )  /  3 )  <=  maxPathEditDistance  && 
36543656                        p . indexOf ( c )  !==  - 1 
36553657                    )  { 
36563658                        // discount distance on substring match 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments