diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-07 16:58:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-07 16:58:22 +0100 |
commit | eb248d85a0eb91bae7bafcd69ffe4dfed3e32fce (patch) | |
tree | ad4255c4ba560c9e2d4fd0f404e91cfd1e71234b /crates/hir_ty/src/infer/expr.rs | |
parent | 062c8eb7cacb38a550889201aaa8b633ede29bb2 (diff) | |
parent | 92dcc53f94455e8933d76a8ba20642ceb069362d (diff) |
Merge #8402
8402: Remove Ty::substs{_mut} r=flodiebold a=flodiebold
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.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 9ab0fa212..9841988c5 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -412,7 +412,10 @@ impl<'a> InferenceContext<'a> { | |||
412 | 412 | ||
413 | self.unify(&ty, &expected.ty); | 413 | self.unify(&ty, &expected.ty); |
414 | 414 | ||
415 | let substs = ty.substs().cloned().unwrap_or_else(|| Substitution::empty(&Interner)); | 415 | let substs = ty |
416 | .as_adt() | ||
417 | .map(|(_, s)| s.clone()) | ||
418 | .unwrap_or_else(|| Substitution::empty(&Interner)); | ||
416 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); | 419 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); |
417 | let variant_data = def_id.map(|it| it.variant_data(self.db.upcast())); | 420 | let variant_data = def_id.map(|it| it.variant_data(self.db.upcast())); |
418 | for field in fields.iter() { | 421 | for field in fields.iter() { |