Intern more TypeRefs in generics

Saves ~3 MB
This commit is contained in:
Jonas Schievink 2021-04-05 02:03:37 +02:00
parent 19e09a4a54
commit 24e876b52e
4 changed files with 15 additions and 14 deletions

View file

@ -32,11 +32,10 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
.filter_map(|pred| match pred {
WherePredicate::ForLifetime { target, bound, .. }
| WherePredicate::TypeBound { target, bound } => match target {
WherePredicateTypeTarget::TypeRef(TypeRef::Path(p))
if p == &Path::from(name![Self]) =>
{
bound.as_path()
}
WherePredicateTypeTarget::TypeRef(type_ref) => match &**type_ref {
TypeRef::Path(p) if p == &Path::from(name![Self]) => bound.as_path(),
_ => None,
},
WherePredicateTypeTarget::TypeParam(local_id) if Some(*local_id) == trait_self => {
bound.as_path()
}