From caee3b6c2d9a7dbcf678cc06d0c1832a4bf19be4 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 7 Apr 2021 21:26:37 +0200 Subject: Replace some `fold` calls --- crates/hir_ty/src/infer/unify.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'crates/hir_ty/src/infer/unify.rs') diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 3732d8ebd..c3d9e81c3 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -118,21 +118,10 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { impl> Canonicalized { pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { - ty.fold_binders( - &mut |ty, binders| { - if let TyKind::BoundVar(bound) = ty.kind(&Interner) { - if bound.debruijn >= binders { - let (v, k) = self.free_vars[bound.index]; - TyKind::InferenceVar(v, k).intern(&Interner) - } else { - ty - } - } else { - ty - } - }, - DebruijnIndex::INNERMOST, - ) + crate::fold_free_vars(ty, |bound, _binders| { + let (v, k) = self.free_vars[bound.index]; + TyKind::InferenceVar(v, k).intern(&Interner) + }) } pub(super) fn apply_solution( -- cgit v1.2.3