mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rustdoc-search: simplify JS in checkGenerics
This commit is contained in:
parent
37998ab508
commit
04f4493722
@ -1179,7 +1179,7 @@ function initSearch(rawSearchIndex) {
|
||||
|
||||
/**
|
||||
* 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 {QueryElement} elem - The element from the parsed query.
|
||||
@ -1196,7 +1196,9 @@ function initSearch(rawSearchIndex) {
|
||||
// This search engine implements order-agnostic unification. There
|
||||
// should be no missing duplicates (generics have "bag semantics"),
|
||||
// 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 addEntryToElems = function addEntryToElems(entry) {
|
||||
if (entry.id === -1) {
|
||||
@ -1271,8 +1273,6 @@ function initSearch(rawSearchIndex) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if the object (`row`) matches the given type (`elem`) and its
|
||||
|
Loading…
Reference in New Issue
Block a user