File tree 2 files changed +42
-4
lines changed
src/librustdoc/html/static/js
2 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -2399,15 +2399,19 @@ function initSearch(rawSearchIndex) {
2399
2399
* @param {boolean } isAssocType
2400
2400
*/
2401
2401
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 ;
2405
2406
} else if ( ! parsedQuery . literalSearch ) {
2406
2407
let match = null ;
2407
2408
let matchDist = maxEditDistance + 1 ;
2408
2409
let matchName = "" ;
2409
2410
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
+ ) ;
2411
2415
if ( dist <= matchDist && dist <= maxEditDistance &&
2412
2416
( isAssocType || ! assocOnly ) ) {
2413
2417
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