Skip to content

Commit 13f3879

Browse files
committed
Fix tidy
1 parent 2427509 commit 13f3879

File tree

1 file changed

+40
-25
lines changed

1 file changed

+40
-25
lines changed

src/librustdoc/html/static/js/search-core.js

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ class DocSearch {
276276
}
277277

278278
/**
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 `"`.
280281
*
281282
* This function will throw an error in the following cases:
282283
* * There is already another string element.
@@ -488,7 +489,8 @@ class DocSearch {
488489
}
489490
const pathSegments = path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/);
490491
// 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] === "")) {
492494
if (generics.length > 0 || prevIs(parserState, ">")) {
493495
throw ["Found generics without a path"];
494496
} else {
@@ -537,8 +539,9 @@ class DocSearch {
537539
}
538540

539541
/**
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.
542545
*
543546
* @param {ParserState} parserState
544547
*
@@ -682,7 +685,8 @@ class DocSearch {
682685
throw ["Type parameter ", "=", ` cannot be within ${friendlyName} `, name];
683686
}
684687
}
685-
if (name === "()" && !foundSeparator && generics.length === 1 && typeFilter === null) {
688+
if (name === "()" && !foundSeparator && generics.length === 1
689+
&& typeFilter === null) {
686690
elems.push(generics[0]);
687691
} else if (name === "()" && generics.length === 1 && generics[0].name === "->") {
688692
// `primitive:(a -> b)` parser to `primitive:"->"<output=b, (a,)>`
@@ -823,11 +827,11 @@ class DocSearch {
823827
}
824828

825829
/**
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.
828832
*
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.
831835
*
832836
* @param {ParsedQuery} query
833837
* @param {ParserState} parserState
@@ -939,9 +943,9 @@ class DocSearch {
939943
if (endChar !== "" && parserState.pos >= parserState.length) {
940944
throw ["Unclosed ", extra];
941945
}
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.
945949
if (posBefore === parserState.pos) {
946950
parserState.pos += 1;
947951
}
@@ -950,16 +954,17 @@ class DocSearch {
950954
if (parserState.pos >= parserState.length && endChar !== "") {
951955
throw ["Unclosed ", extra];
952956
}
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.
955959
parserState.pos += 1;
956960

957961
if (hofParameters) {
958962
// Commas in a HOF don't cause wrapping parens to become a tuple.
959963
// If you want a one-tuple with a HOF in it, write `((a -> b),)`.
960964
foundSeparator = false;
961965
// 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) {
963968
throw ["Unexpected ", "=", " within ", "->"];
964969
}
965970
// HOFs are represented the same way closures are.
@@ -1009,8 +1014,8 @@ class DocSearch {
10091014
* functions that operate on a small set of data types, so the search index compresses them
10101015
* by encoding function parameter and return types as indexes into an array of names.
10111016
*
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
10141019
*
10151020
* The format for individual function types is encoded in
10161021
* librustdoc/html/render/mod.rs: impl Serialize for RenderType
@@ -1172,9 +1177,10 @@ class DocSearch {
11721177
/**
11731178
* Convert from RawFunctionSearchType to FunctionSearchType.
11741179
*
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.
11781184
*
11791185
* The raw function search type format is generated using serde in
11801186
* librustdoc/html/render/mod.rs: IndexItemFunctionType::write_to_string
@@ -1201,7 +1207,9 @@ class DocSearch {
12011207
}
12021208
if (functionSearchType.length > 1) {
12031209
if (typeof functionSearchType[OUTPUT_DATA] === "number") {
1204-
output = [buildItemSearchType(functionSearchType[OUTPUT_DATA], lowercasePaths)];
1210+
output = [
1211+
buildItemSearchType(functionSearchType[OUTPUT_DATA], lowercasePaths)
1212+
];
12051213
} else {
12061214
output = buildItemSearchTypeAll(
12071215
functionSearchType[OUTPUT_DATA],
@@ -1669,14 +1677,16 @@ class DocSearch {
16691677
path,
16701678
descShard,
16711679
descIndex,
1672-
exactPath: itemReexports.has(i) ? itemPaths.get(itemReexports.get(i)) : path,
1680+
exactPath: itemReexports.has(i) ?
1681+
itemPaths.get(itemReexports.get(i)) : path,
16731682
parent: itemParentIdxs[i] > 0 ? paths[itemParentIdxs[i] - 1] : undefined,
16741683
type,
16751684
id,
16761685
word,
16771686
normalizedName: word.indexOf("_") === -1 ? word : word.replace(/_/g, ""),
16781687
bitIndex,
1679-
implDisambiguator: implDisambiguator.has(i) ? implDisambiguator.get(i) : null,
1688+
implDisambiguator: implDisambiguator.has(i) ?
1689+
implDisambiguator.get(i) : null,
16801690
};
16811691
id += 1;
16821692
searchIndex.push(row);
@@ -1811,7 +1821,8 @@ class DocSearch {
18111821
}
18121822
throw ["Unexpected ", c, " (did you mean ", "->", "?)"];
18131823
} 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]];
18151826
}
18161827
throw ["Unexpected ", c];
18171828
} else if (c === " ") {
@@ -1942,7 +1953,11 @@ class DocSearch {
19421953
*
19431954
* @return {ResultsTable}
19441955
*/
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) {
19461961
return {
19471962
"in_args": results_in_args,
19481963
"returned": results_returned,

0 commit comments

Comments
 (0)