From 92dcc53f94455e8933d76a8ba20642ceb069362d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 7 Apr 2021 17:26:01 +0200 Subject: Remove Ty::substs{_mut} Almost all uses actually only care about ADT substs, so it's better to be explicit. The methods were a bad abstraction anyway since they already didn't include the inner types of e.g. `TyKind::Ref` anymore. --- crates/hir_ty/src/infer/pat.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/infer/pat.rs') diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index e4813c87c..f88d5c5d3 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -33,7 +33,8 @@ impl<'a> InferenceContext<'a> { } self.unify(&ty, expected); - let substs = ty.substs().cloned().unwrap_or_else(|| Substitution::empty(&Interner)); + let substs = + ty.as_adt().map(|(_, s)| s.clone()).unwrap_or_else(|| Substitution::empty(&Interner)); let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); let (pre, post) = match ellipsis { @@ -74,7 +75,8 @@ impl<'a> InferenceContext<'a> { self.unify(&ty, expected); - let substs = ty.substs().cloned().unwrap_or_else(|| Substitution::empty(&Interner)); + let substs = + ty.as_adt().map(|(_, s)| s.clone()).unwrap_or_else(|| Substitution::empty(&Interner)); let field_tys = def.map(|it| self.db.field_types(it)).unwrap_or_default(); for subpat in subpats { -- cgit v1.2.3