Clean up variables in search.js
This commit is contained in:
parent
6f40082313
commit
f1342f30a5
@ -2102,8 +2102,6 @@ function initSearch(rawSearchIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function innerRunQuery() {
|
function innerRunQuery() {
|
||||||
let elem, i, nSearchWords, in_returned, row;
|
|
||||||
|
|
||||||
let queryLen = 0;
|
let queryLen = 0;
|
||||||
for (const elem of parsedQuery.elems) {
|
for (const elem of parsedQuery.elems) {
|
||||||
queryLen += elem.name.length;
|
queryLen += elem.name.length;
|
||||||
@ -2225,8 +2223,8 @@ function initSearch(rawSearchIndex) {
|
|||||||
|
|
||||||
if (parsedQuery.foundElems === 1) {
|
if (parsedQuery.foundElems === 1) {
|
||||||
if (parsedQuery.elems.length === 1) {
|
if (parsedQuery.elems.length === 1) {
|
||||||
elem = parsedQuery.elems[0];
|
const elem = parsedQuery.elems[0];
|
||||||
for (i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
for (let i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
||||||
// It means we want to check for this element everywhere (in names, args and
|
// It means we want to check for this element everywhere (in names, args and
|
||||||
// returned).
|
// returned).
|
||||||
handleSingleArg(
|
handleSingleArg(
|
||||||
@ -2241,10 +2239,9 @@ function initSearch(rawSearchIndex) {
|
|||||||
}
|
}
|
||||||
} else if (parsedQuery.returned.length === 1) {
|
} else if (parsedQuery.returned.length === 1) {
|
||||||
// We received one returned argument to check, so looking into returned values.
|
// We received one returned argument to check, so looking into returned values.
|
||||||
elem = parsedQuery.returned[0];
|
for (let i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
||||||
for (i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
const row = searchIndex[i];
|
||||||
row = searchIndex[i];
|
const in_returned = row.type && unifyFunctionTypes(
|
||||||
in_returned = row.type && unifyFunctionTypes(
|
|
||||||
row.type.output,
|
row.type.output,
|
||||||
parsedQuery.returned,
|
parsedQuery.returned,
|
||||||
row.type.where_clause
|
row.type.where_clause
|
||||||
@ -2262,7 +2259,7 @@ function initSearch(rawSearchIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (parsedQuery.foundElems > 0) {
|
} else if (parsedQuery.foundElems > 0) {
|
||||||
for (i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
for (let i = 0, nSearchWords = searchWords.length; i < nSearchWords; ++i) {
|
||||||
handleArgs(searchIndex[i], i, results_others);
|
handleArgs(searchIndex[i], i, results_others);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2418,7 +2415,6 @@ function initSearch(rawSearchIndex) {
|
|||||||
const extraClass = display ? " active" : "";
|
const extraClass = display ? " active" : "";
|
||||||
|
|
||||||
const output = document.createElement("div");
|
const output = document.createElement("div");
|
||||||
let length = 0;
|
|
||||||
if (array.length > 0) {
|
if (array.length > 0) {
|
||||||
output.className = "search-results " + extraClass;
|
output.className = "search-results " + extraClass;
|
||||||
|
|
||||||
@ -2428,8 +2424,6 @@ function initSearch(rawSearchIndex) {
|
|||||||
const longType = longItemTypes[item.ty];
|
const longType = longItemTypes[item.ty];
|
||||||
const typeName = longType.length !== 0 ? `${longType}` : "?";
|
const typeName = longType.length !== 0 ? `${longType}` : "?";
|
||||||
|
|
||||||
length += 1;
|
|
||||||
|
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.className = "result-" + type;
|
link.className = "result-" + type;
|
||||||
link.href = item.href;
|
link.href = item.href;
|
||||||
@ -2477,7 +2471,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
|
|||||||
"href=\"https://docs.rs\">Docs.rs</a> for documentation of crates released on" +
|
"href=\"https://docs.rs\">Docs.rs</a> for documentation of crates released on" +
|
||||||
" <a href=\"https://crates.io/\">crates.io</a>.</li></ul>";
|
" <a href=\"https://crates.io/\">crates.io</a>.</li></ul>";
|
||||||
}
|
}
|
||||||
return [output, length];
|
return [output, array.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeTabHeader(tabNb, text, nbElems) {
|
function makeTabHeader(tabNb, text, nbElems) {
|
||||||
|
Loading…
Reference in New Issue
Block a user