File tree Expand file tree Collapse file tree 2 files changed +42
-4
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 2 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -2399,15 +2399,19 @@ function initSearch(rawSearchIndex) {
23992399 * @param {boolean } isAssocType
24002400 */
24012401 function convertNameToId ( elem , isAssocType ) {
2402- if ( typeNameIdMap . has ( elem . normalizedPathLast ) &&
2403- ( isAssocType || ! typeNameIdMap . get ( elem . normalizedPathLast ) . assocOnly ) ) {
2404- elem . id = typeNameIdMap . get ( elem . normalizedPathLast ) . id ;
2402+ const loweredName = elem . pathLast . toLowerCase ( ) ;
2403+ if ( typeNameIdMap . has ( loweredName ) &&
2404+ ( isAssocType || ! typeNameIdMap . get ( loweredName ) . assocOnly ) ) {
2405+ elem . id = typeNameIdMap . get ( loweredName ) . id ;
24052406 } else if ( ! parsedQuery . literalSearch ) {
24062407 let match = null ;
24072408 let matchDist = maxEditDistance + 1 ;
24082409 let matchName = "" ;
24092410 for ( const [ name , { id, assocOnly} ] of typeNameIdMap ) {
2410- const dist = editDistance ( name , elem . normalizedPathLast , maxEditDistance ) ;
2411+ const dist = Math . min (
2412+ editDistance ( name , loweredName , maxEditDistance ) ,
2413+ editDistance ( name , elem . normalizedPathLast , maxEditDistance ) ,
2414+ ) ;
24112415 if ( dist <= matchDist && dist <= maxEditDistance &&
24122416 ( isAssocType || ! assocOnly ) ) {
24132417 if ( dist === matchDist && matchName > name ) {
Original file line number Diff line number Diff line change 1+ const FILTER_CRATE = 'std' ;
2+
3+ const EXPECTED = [
4+ {
5+ 'query' : 'pid_t' ,
6+ 'correction' : null ,
7+ 'proposeCorrectionFrom' : null ,
8+ 'proposeCorrectionTo' : null ,
9+ 'others' : [
10+ { 'path' : 'std::os::unix::raw' , 'name' : 'pid_t' } ,
11+ ] ,
12+ 'returned' : [
13+ { 'path' : 'std::os::unix::net::SocketCred' , 'name' : 'set_pid' } ,
14+ ] ,
15+ 'returned' : [
16+ { 'path' : 'std::os::unix::net::SocketCred' , 'name' : 'get_pid' } ,
17+ ] ,
18+ } ,
19+ {
20+ 'query' : 'pidt' ,
21+ 'correction' : 'pid_t' ,
22+ 'proposeCorrectionFrom' : null ,
23+ 'proposeCorrectionTo' : null ,
24+ 'others' : [
25+ { 'path' : 'std::os::unix::raw' , 'name' : 'pid_t' } ,
26+ ] ,
27+ 'returned' : [
28+ { 'path' : 'std::os::unix::net::SocketCred' , 'name' : 'set_pid' } ,
29+ ] ,
30+ 'returned' : [
31+ { 'path' : 'std::os::unix::net::SocketCred' , 'name' : 'get_pid' } ,
32+ ] ,
33+ } ,
34+ ] ;
You can’t perform that action at this time.
0 commit comments