rustdoc-search: simplify JS in checkGenerics
This commit is contained in:
parent
37998ab508
commit
04f4493722
1 changed files with 69 additions and 69 deletions
|
@ -1179,7 +1179,7 @@ function initSearch(rawSearchIndex) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks if the object (`row`) generics match the given type (`elem`)
|
* This function checks if the object (`row`) generics match the given type (`elem`)
|
||||||
* generics. If there are no generics on `row`, `defaultDistance` is returned.
|
* generics.
|
||||||
*
|
*
|
||||||
* @param {Row} row - The object to check.
|
* @param {Row} row - The object to check.
|
||||||
* @param {QueryElement} elem - The element from the parsed query.
|
* @param {QueryElement} elem - The element from the parsed query.
|
||||||
|
@ -1196,7 +1196,9 @@ function initSearch(rawSearchIndex) {
|
||||||
// This search engine implements order-agnostic unification. There
|
// This search engine implements order-agnostic unification. There
|
||||||
// should be no missing duplicates (generics have "bag semantics"),
|
// should be no missing duplicates (generics have "bag semantics"),
|
||||||
// and the row is allowed to have extras.
|
// and the row is allowed to have extras.
|
||||||
if (elem.generics.length > 0 && row.generics.length >= elem.generics.length) {
|
if (elem.generics.length <= 0 || row.generics.length < elem.generics.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const elems = new Map();
|
const elems = new Map();
|
||||||
const addEntryToElems = function addEntryToElems(entry) {
|
const addEntryToElems = function addEntryToElems(entry) {
|
||||||
if (entry.id === -1) {
|
if (entry.id === -1) {
|
||||||
|
@ -1271,8 +1273,6 @@ function initSearch(rawSearchIndex) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks if the object (`row`) matches the given type (`elem`) and its
|
* This function checks if the object (`row`) matches the given type (`elem`) and its
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue