@@ -320,8 +320,8 @@ window.initSearch = rawSearchIndex => {
320320 if ( foundExclamation ) {
321321 throw new Error ( "Cannot have more than one `!` in an ident" ) ;
322322 } else if ( parserState . pos + 1 < parserState . length &&
323- isIdentCharacter ( parserState . userQuery [ parserState . pos + 1 ] ) )
324- {
323+ isIdentCharacter ( parserState . userQuery [ parserState . pos + 1 ] )
324+ ) {
325325 throw new Error ( "`!` can only be at the end of an ident" ) ;
326326 }
327327 foundExclamation = true ;
@@ -330,12 +330,10 @@ window.initSearch = rawSearchIndex => {
330330 } else if (
331331 isStopCharacter ( c ) ||
332332 isSpecialStartCharacter ( c ) ||
333- isSeparatorCharacter ( c ) )
334- {
333+ isSeparatorCharacter ( c )
334+ ) {
335335 break ;
336- }
337- // If we allow paths ("str::string" for example).
338- else if ( c === ":" ) {
336+ } else if ( c === ":" ) { // If we allow paths ("str::string" for example).
339337 if ( ! isPathStart ( parserState ) ) {
340338 break ;
341339 }
@@ -372,8 +370,8 @@ window.initSearch = rawSearchIndex => {
372370 end = getIdentEndPosition ( parserState ) ;
373371 }
374372 if ( parserState . pos < parserState . length &&
375- parserState . userQuery [ parserState . pos ] === "<" )
376- {
373+ parserState . userQuery [ parserState . pos ] === "<"
374+ ) {
377375 if ( isInGenerics ) {
378376 throw new Error ( "Unexpected `<` after `<`" ) ;
379377 } else if ( start >= end ) {
@@ -592,8 +590,8 @@ window.initSearch = rawSearchIndex => {
592590
593591 if ( elem &&
594592 elem . value !== "All crates" &&
595- hasOwnPropertyRustdoc ( rawSearchIndex , elem . value ) )
596- {
593+ hasOwnPropertyRustdoc ( rawSearchIndex , elem . value )
594+ ) {
597595 return elem . value ;
598596 }
599597 return null ;
@@ -786,37 +784,51 @@ window.initSearch = rawSearchIndex => {
786784 // sort by exact match with regard to the last word (mismatch goes later)
787785 a = ( aaa . word !== userQuery ) ;
788786 b = ( bbb . word !== userQuery ) ;
789- if ( a !== b ) { return a - b ; }
787+ if ( a !== b ) {
788+ return a - b ;
789+ }
790790
791791 // Sort by non levenshtein results and then levenshtein results by the distance
792792 // (less changes required to match means higher rankings)
793793 a = ( aaa . lev ) ;
794794 b = ( bbb . lev ) ;
795- if ( a !== b ) { return a - b ; }
795+ if ( a !== b ) {
796+ return a - b ;
797+ }
796798
797799 // sort by crate (non-current crate goes later)
798800 a = ( aaa . item . crate !== window . currentCrate ) ;
799801 b = ( bbb . item . crate !== window . currentCrate ) ;
800- if ( a !== b ) { return a - b ; }
802+ if ( a !== b ) {
803+ return a - b ;
804+ }
801805
802806 // sort by item name length (longer goes later)
803807 a = aaa . word . length ;
804808 b = bbb . word . length ;
805- if ( a !== b ) { return a - b ; }
809+ if ( a !== b ) {
810+ return a - b ;
811+ }
806812
807813 // sort by item name (lexicographically larger goes later)
808814 a = aaa . word ;
809815 b = bbb . word ;
810- if ( a !== b ) { return ( a > b ? + 1 : - 1 ) ; }
816+ if ( a !== b ) {
817+ return ( a > b ? + 1 : - 1 ) ;
818+ }
811819
812820 // sort by index of keyword in item name (no literal occurrence goes later)
813821 a = ( aaa . index < 0 ) ;
814822 b = ( bbb . index < 0 ) ;
815- if ( a !== b ) { return a - b ; }
823+ if ( a !== b ) {
824+ return a - b ;
825+ }
816826 // (later literal occurrence, if any, goes later)
817827 a = aaa . index ;
818828 b = bbb . index ;
819- if ( a !== b ) { return a - b ; }
829+ if ( a !== b ) {
830+ return a - b ;
831+ }
820832
821833 // special precedence for primitive and keyword pages
822834 if ( ( aaa . item . ty === TY_PRIMITIVE && bbb . item . ty !== TY_KEYWORD ) ||
@@ -831,17 +843,23 @@ window.initSearch = rawSearchIndex => {
831843 // sort by description (no description goes later)
832844 a = ( aaa . item . desc === "" ) ;
833845 b = ( bbb . item . desc === "" ) ;
834- if ( a !== b ) { return a - b ; }
846+ if ( a !== b ) {
847+ return a - b ;
848+ }
835849
836850 // sort by type (later occurrence in `itemTypes` goes later)
837851 a = aaa . item . ty ;
838852 b = bbb . item . ty ;
839- if ( a !== b ) { return a - b ; }
853+ if ( a !== b ) {
854+ return a - b ;
855+ }
840856
841857 // sort by path (lexicographically larger goes later)
842858 a = aaa . item . path ;
843859 b = bbb . item . path ;
844- if ( a !== b ) { return ( a > b ? + 1 : - 1 ) ; }
860+ if ( a !== b ) {
861+ return ( a > b ? + 1 : - 1 ) ;
862+ }
845863
846864 // que sera, sera
847865 return 0 ;
@@ -1315,16 +1333,15 @@ window.initSearch = rawSearchIndex => {
13151333 }
13161334
13171335 if ( searchWord . indexOf ( elem . pathLast ) > - 1 ||
1318- row . normalizedName . indexOf ( elem . pathLast ) > - 1 )
1319- {
1336+ row . normalizedName . indexOf ( elem . pathLast ) > - 1
1337+ ) {
13201338 // filter type: ... queries
13211339 if ( ! results_others [ fullId ] !== undefined ) {
13221340 index = row . normalizedName . indexOf ( elem . pathLast ) ;
13231341 }
13241342 }
13251343 lev = levenshtein ( searchWord , elem . pathLast ) ;
1326- if ( lev > 0 && elem . pathLast . length > 2 && searchWord . indexOf ( elem . pathLast ) > - 1 )
1327- {
1344+ if ( lev > 0 && elem . pathLast . length > 2 && searchWord . indexOf ( elem . pathLast ) > - 1 ) {
13281345 if ( elem . pathLast . length < 6 ) {
13291346 lev = 1 ;
13301347 } else {
@@ -1670,8 +1687,8 @@ window.initSearch = rawSearchIndex => {
16701687 // By default, the search DOM element is "empty" (meaning it has no children not
16711688 // text content). Once a search has been run, it won't be empty, even if you press
16721689 // ESC or empty the search input (which also "cancels" the search).
1673- && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) ) )
1674- {
1690+ && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) )
1691+ ) {
16751692 const elem = document . createElement ( "a" ) ;
16761693 elem . href = results . others [ 0 ] . href ;
16771694 removeClass ( elem , "active" ) ;
@@ -1766,7 +1783,7 @@ window.initSearch = rawSearchIndex => {
17661783 let i = 0 ;
17671784 for ( const elem of elems ) {
17681785 const j = i ;
1769- elem . onclick = ( ) => { printTab ( j ) ; } ;
1786+ elem . onclick = ( ) => printTab ( j ) ;
17701787 searchState . focusedByTab . push ( null ) ;
17711788 i += 1 ;
17721789 }
0 commit comments