From a78f0076abbbf61f7b68ce5c323639037c8a72de Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 16 May 2021 15:56:27 +0200 Subject: Make resolve_ty_shallow return Ty --- crates/hir_ty/src/infer/unify.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 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 75e04e8b5..278127c69 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -1,6 +1,6 @@ //! Unification and canonicalization logic. -use std::{borrow::Cow, fmt, mem, sync::Arc}; +use std::{fmt, mem, sync::Arc}; use chalk_ir::{ cast::Cast, fold::Fold, interner::HasInterner, zip::Zip, FloatTy, IntTy, TyVariableKind, @@ -340,11 +340,8 @@ impl<'a> InferenceTable<'a> { /// If `ty` is a type variable with known type, returns that type; /// otherwise, return ty. - // FIXME this could probably just return Ty - pub(crate) fn resolve_ty_shallow<'b>(&mut self, ty: &'b Ty) -> Cow<'b, Ty> { - self.var_unification_table - .normalize_ty_shallow(&Interner, ty) - .map_or(Cow::Borrowed(ty), Cow::Owned) + pub(crate) fn resolve_ty_shallow(&mut self, ty: &Ty) -> Ty { + self.var_unification_table.normalize_ty_shallow(&Interner, ty).unwrap_or_else(|| ty.clone()) } /// Resolves the type as far as currently possible, replacing type variables -- cgit v1.2.3