dev: use more safe retainer for gc (#817)

This commit is contained in:
Myriad-Dreamin 2024-11-14 21:21:27 +08:00 committed by GitHub
parent bbcca41909
commit dd2a22a67d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,22 +218,12 @@ impl LocalContextGuard {
break; break;
} }
self.analysis let retainer = |l: u64| lifetime.saturating_sub(l) < 60;
.caches let caches = &self.analysis.caches;
.def_signatures caches.def_signatures.retain(|(l, _)| retainer(*l));
.retain(|(l, _)| lifetime - *l < 60); caches.static_signatures.retain(|(l, _)| retainer(*l));
self.analysis caches.terms.retain(|(l, _)| retainer(*l));
.caches caches.signatures.retain(|(l, _)| retainer(*l));
.static_signatures
.retain(|(l, _)| lifetime - *l < 60);
self.analysis
.caches
.terms
.retain(|(l, _)| lifetime - *l < 60);
self.analysis
.caches
.signatures
.retain(|(l, _)| lifetime - *l < 60);
} }
} }