@@ -276,7 +276,8 @@ class DocSearch {
276
276
}
277
277
278
278
/**
279
- * If we encounter a `"`, then we try to extract the string from it until we find another `"`.
279
+ * If we encounter a `"`, then we try to extract the string
280
+ * from it until we find another `"`.
280
281
*
281
282
* This function will throw an error in the following cases:
282
283
* * There is already another string element.
@@ -488,7 +489,8 @@ class DocSearch {
488
489
}
489
490
const pathSegments = path . split ( / (?: : : \s * ) | (?: \s + (?: : : \s * ) ? ) / ) ;
490
491
// In case we only have something like `<p>`, there is no name.
491
- if ( pathSegments . length === 0 || ( pathSegments . length === 1 && pathSegments [ 0 ] === "" ) ) {
492
+ if ( pathSegments . length === 0
493
+ || ( pathSegments . length === 1 && pathSegments [ 0 ] === "" ) ) {
492
494
if ( generics . length > 0 || prevIs ( parserState , ">" ) ) {
493
495
throw [ "Found generics without a path" ] ;
494
496
} else {
@@ -537,8 +539,9 @@ class DocSearch {
537
539
}
538
540
539
541
/**
540
- * This function goes through all characters until it reaches an invalid ident character or the
541
- * end of the query. It returns the position of the last character of the ident.
542
+ * This function goes through all characters until it reaches an invalid ident
543
+ * character or the end of the query. It returns the position of the last
544
+ * character of the ident.
542
545
*
543
546
* @param {ParserState } parserState
544
547
*
@@ -682,7 +685,8 @@ class DocSearch {
682
685
throw [ "Type parameter " , "=" , ` cannot be within ${ friendlyName } ` , name ] ;
683
686
}
684
687
}
685
- if ( name === "()" && ! foundSeparator && generics . length === 1 && typeFilter === null ) {
688
+ if ( name === "()" && ! foundSeparator && generics . length === 1
689
+ && typeFilter === null ) {
686
690
elems . push ( generics [ 0 ] ) ;
687
691
} else if ( name === "()" && generics . length === 1 && generics [ 0 ] . name === "->" ) {
688
692
// `primitive:(a -> b)` parser to `primitive:"->"<output=b, (a,)>`
@@ -823,11 +827,11 @@ class DocSearch {
823
827
}
824
828
825
829
/**
826
- * This function parses the next query element until it finds `endChar`, calling `getNextElem`
827
- * to collect each element.
830
+ * This function parses the next query element until it finds `endChar`,
831
+ * calling `getNextElem` to collect each element.
828
832
*
829
- * If there is no `endChar`, this function will implicitly stop at the end without raising an
830
- * error.
833
+ * If there is no `endChar`, this function will implicitly stop at the end
834
+ * without raising an error.
831
835
*
832
836
* @param {ParsedQuery } query
833
837
* @param {ParserState } parserState
@@ -939,9 +943,9 @@ class DocSearch {
939
943
if ( endChar !== "" && parserState . pos >= parserState . length ) {
940
944
throw [ "Unclosed " , extra ] ;
941
945
}
942
- // This case can be encountered if `getNextElem` encountered a "stop character" right
943
- // from the start. For example if you have `,,` or `<>`. In this case, we simply move up
944
- // the current position to continue the parsing.
946
+ // This case can be encountered if `getNextElem` encountered a "stop character"
947
+ // right from the start. For example if you have `,,` or `<>`. In this case,
948
+ // we simply move up the current position to continue the parsing.
945
949
if ( posBefore === parserState . pos ) {
946
950
parserState . pos += 1 ;
947
951
}
@@ -950,16 +954,17 @@ class DocSearch {
950
954
if ( parserState . pos >= parserState . length && endChar !== "" ) {
951
955
throw [ "Unclosed " , extra ] ;
952
956
}
953
- // We are either at the end of the string or on the `endChar` character, let's move forward
954
- // in any case.
957
+ // We are either at the end of the string or on the `endChar` character, let's move
958
+ // forward in any case.
955
959
parserState . pos += 1 ;
956
960
957
961
if ( hofParameters ) {
958
962
// Commas in a HOF don't cause wrapping parens to become a tuple.
959
963
// If you want a one-tuple with a HOF in it, write `((a -> b),)`.
960
964
foundSeparator = false ;
961
965
// HOFs can't have directly nested bindings.
962
- if ( [ ...elems , ...hofParameters ] . some ( x => x . bindingName ) || parserState . isInBinding ) {
966
+ if ( [ ...elems , ...hofParameters ] . some ( x => x . bindingName )
967
+ || parserState . isInBinding ) {
963
968
throw [ "Unexpected " , "=" , " within " , "->" ] ;
964
969
}
965
970
// HOFs are represented the same way closures are.
@@ -1009,8 +1014,8 @@ class DocSearch {
1009
1014
* functions that operate on a small set of data types, so the search index compresses them
1010
1015
* by encoding function parameter and return types as indexes into an array of names.
1011
1016
*
1012
- * Even when a general-purpose compression algorithm is used, this is still a win. I checked.
1013
- * https://github.com/rust-lang/rust/pull/98475#issue-1284395985
1017
+ * Even when a general-purpose compression algorithm is used, this is still a win.
1018
+ * I checked. https://github.com/rust-lang/rust/pull/98475#issue-1284395985
1014
1019
*
1015
1020
* The format for individual function types is encoded in
1016
1021
* librustdoc/html/render/mod.rs: impl Serialize for RenderType
@@ -1172,9 +1177,10 @@ class DocSearch {
1172
1177
/**
1173
1178
* Convert from RawFunctionSearchType to FunctionSearchType.
1174
1179
*
1175
- * Crates often have lots of functions in them, and function signatures are sometimes complex,
1176
- * so rustdoc uses a pretty tight encoding for them. This function converts it to a simpler,
1177
- * object-based encoding so that the actual search code is more readable and easier to debug.
1180
+ * Crates often have lots of functions in them, and function signatures are sometimes
1181
+ * complex, so rustdoc uses a pretty tight encoding for them. This function converts it
1182
+ * to a simpler, object-based encoding so that the actual search code is more readable
1183
+ * and easier to debug.
1178
1184
*
1179
1185
* The raw function search type format is generated using serde in
1180
1186
* librustdoc/html/render/mod.rs: IndexItemFunctionType::write_to_string
@@ -1201,7 +1207,9 @@ class DocSearch {
1201
1207
}
1202
1208
if ( functionSearchType . length > 1 ) {
1203
1209
if ( typeof functionSearchType [ OUTPUT_DATA ] === "number" ) {
1204
- output = [ buildItemSearchType ( functionSearchType [ OUTPUT_DATA ] , lowercasePaths ) ] ;
1210
+ output = [
1211
+ buildItemSearchType ( functionSearchType [ OUTPUT_DATA ] , lowercasePaths )
1212
+ ] ;
1205
1213
} else {
1206
1214
output = buildItemSearchTypeAll (
1207
1215
functionSearchType [ OUTPUT_DATA ] ,
@@ -1669,14 +1677,16 @@ class DocSearch {
1669
1677
path,
1670
1678
descShard,
1671
1679
descIndex,
1672
- exactPath : itemReexports . has ( i ) ? itemPaths . get ( itemReexports . get ( i ) ) : path ,
1680
+ exactPath : itemReexports . has ( i ) ?
1681
+ itemPaths . get ( itemReexports . get ( i ) ) : path ,
1673
1682
parent : itemParentIdxs [ i ] > 0 ? paths [ itemParentIdxs [ i ] - 1 ] : undefined ,
1674
1683
type,
1675
1684
id,
1676
1685
word,
1677
1686
normalizedName : word . indexOf ( "_" ) === - 1 ? word : word . replace ( / _ / g, "" ) ,
1678
1687
bitIndex,
1679
- implDisambiguator : implDisambiguator . has ( i ) ? implDisambiguator . get ( i ) : null ,
1688
+ implDisambiguator : implDisambiguator . has ( i ) ?
1689
+ implDisambiguator . get ( i ) : null ,
1680
1690
} ;
1681
1691
id += 1 ;
1682
1692
searchIndex . push ( row ) ;
@@ -1811,7 +1821,8 @@ class DocSearch {
1811
1821
}
1812
1822
throw [ "Unexpected " , c , " (did you mean " , "->" , "?)" ] ;
1813
1823
} else if ( parserState . pos > 0 ) {
1814
- throw [ "Unexpected " , c , " after " , parserState . userQuery [ parserState . pos - 1 ] ] ;
1824
+ throw [ "Unexpected " , c , " after " ,
1825
+ parserState . userQuery [ parserState . pos - 1 ] ] ;
1815
1826
}
1816
1827
throw [ "Unexpected " , c ] ;
1817
1828
} else if ( c === " " ) {
@@ -1942,7 +1953,11 @@ class DocSearch {
1942
1953
*
1943
1954
* @return {ResultsTable }
1944
1955
*/
1945
- function createQueryResults ( results_in_args , results_returned , results_others , parsedQuery ) {
1956
+ function createQueryResults (
1957
+ results_in_args ,
1958
+ results_returned ,
1959
+ results_others ,
1960
+ parsedQuery ) {
1946
1961
return {
1947
1962
"in_args" : results_in_args ,
1948
1963
"returned" : results_returned ,
0 commit comments