Skip to content

Commit

Permalink
rustdoc-search: clean up handleSingleArg type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Dec 13, 2023
1 parent 9dfcf13 commit bec6672
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2000,24 +2000,18 @@ function initSearch(rawSearchIndex) {
fullId,
parsedQuery.typeFingerprint
);
if (tfpDist !== null &&
!(results_in_args.size >= MAX_RESULTS && tfpDist > results_in_args.max_dist)
) {
if (tfpDist !== null) {
const in_args = row.type && row.type.inputs
&& checkIfInList(row.type.inputs, elem, row.type.where_clause);
const returned = row.type && row.type.output
&& checkIfInList(row.type.output, elem, row.type.where_clause);
if (in_args) {
results_in_args.max_dist = Math.max(results_in_args.max_dist || 0, tfpDist);
const maxDist = results_in_args.size < MAX_RESULTS ?
(tfpDist + 1) :
results_in_args.max_dist;
addIntoResults(results_in_args, fullId, pos, -1, tfpDist, 0, maxDist);
}
}
if (tfpDist !== false &&
!(results_returned.size >= MAX_RESULTS && tfpDist > results_returned.max_dist)
) {
const returned = row.type && row.type.output
&& checkIfInList(row.type.output, elem, row.type.where_clause);
if (returned) {
results_returned.max_dist = Math.max(results_returned.max_dist || 0, tfpDist);
const maxDist = results_returned.size < MAX_RESULTS ?
Expand Down

0 comments on commit bec6672

Please sign in to comment.