Simplify bound var resolution.

This commit is contained in:
Camille GILLOT 2024-08-18 16:10:54 +00:00
parent c7cb45a791
commit 6ec58a44e2
4 changed files with 39 additions and 44 deletions

View file

@ -2996,7 +2996,7 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn named_bound_var(self, id: HirId) -> Option<resolve_bound_vars::ResolvedArg> {
debug!(?id, "named_region");
self.named_variable_map(id.owner).and_then(|map| map.get(&id.local_id).cloned())
self.named_variable_map(id.owner).get(&id.local_id).cloned()
}
pub fn is_late_bound(self, id: HirId) -> bool {
@ -3005,12 +3005,9 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn late_bound_vars(self, id: HirId) -> &'tcx List<ty::BoundVariableKind> {
self.mk_bound_variable_kinds(
&self
.late_bound_vars_map(id.owner)
.and_then(|map| map.get(&id.local_id).cloned())
.unwrap_or_else(|| {
bug!("No bound vars found for {}", self.hir().node_to_string(id))
}),
&self.late_bound_vars_map(id.owner).get(&id.local_id).cloned().unwrap_or_else(|| {
bug!("No bound vars found for {}", self.hir().node_to_string(id))
}),
)
}