rustdoc-search: simplify the checkTypes fast path
This reduces code size while still matching the common case for plain, concrete types.
This commit is contained in:
parent
488d5b0d8e
commit
2cc1c0c39a
@ -2727,33 +2727,18 @@ class DocSearch {
|
|||||||
if (unboxingDepth >= UNBOXING_LIMIT) {
|
if (unboxingDepth >= UNBOXING_LIMIT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (row.bindings.size === 0 && elem.bindings.size === 0) {
|
if (row.id > 0 && elem.id > 0 && elem.pathWithoutLast.length === 0 &&
|
||||||
if (elem.id < 0 && mgens === null) {
|
row.generics.length === 0 && elem.generics.length === 0 &&
|
||||||
return row.id < 0 || checkIfInList(
|
row.bindings.size === 0 && elem.bindings.size === 0 &&
|
||||||
row.generics,
|
// special case
|
||||||
elem,
|
elem.id !== this.typeNameIdOfArrayOrSlice &&
|
||||||
whereClause,
|
elem.id !== this.typeNameIdOfHof &&
|
||||||
mgens,
|
elem.id !== this.typeNameIdOfTupleOrUnit
|
||||||
unboxingDepth + 1,
|
) {
|
||||||
);
|
return row.id === elem.id && typePassesFilter(elem.typeFilter, row.ty);
|
||||||
}
|
} else {
|
||||||
if (row.id > 0 && elem.id > 0 && elem.pathWithoutLast.length === 0 &&
|
return unifyFunctionTypes([row], [elem], whereClause, mgens, null, unboxingDepth);
|
||||||
typePassesFilter(elem.typeFilter, row.ty) && elem.generics.length === 0 &&
|
|
||||||
// special case
|
|
||||||
elem.id !== this.typeNameIdOfArrayOrSlice
|
|
||||||
&& elem.id !== this.typeNameIdOfTupleOrUnit
|
|
||||||
&& elem.id !== this.typeNameIdOfHof
|
|
||||||
) {
|
|
||||||
return row.id === elem.id || checkIfInList(
|
|
||||||
row.generics,
|
|
||||||
elem,
|
|
||||||
whereClause,
|
|
||||||
mgens,
|
|
||||||
unboxingDepth,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return unifyFunctionTypes([row], [elem], whereClause, mgens, null, unboxingDepth);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user