From e9752308bbaa2fd720e1eeaca970977fe22514d1 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 6 Apr 2021 17:59:18 +0200 Subject: infer: remove `record_field_resolutions` field It stores no useful data, since we can derive all fields from `variant_resolutions` --- crates/hir_ty/src/diagnostics/expr.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/hir_ty/src/diagnostics') diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index d7bf9fdf7..79602c3dd 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs @@ -14,7 +14,6 @@ use crate::{ MismatchedArgCount, MissingFields, MissingMatchArms, MissingOkOrSomeInTailExpr, MissingPatFields, RemoveThisSemicolon, }, - utils::variant_data, AdtId, InferenceResult, Interner, TyExt, TyKind, }; @@ -104,7 +103,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { let root = source_ptr.file_syntax(db.upcast()); if let ast::Expr::RecordExpr(record_expr) = &source_ptr.value.to_node(&root) { if let Some(_) = record_expr.record_expr_field_list() { - let variant_data = variant_data(db.upcast(), variant_def); + let variant_data = variant_def.variant_data(db.upcast()); let missed_fields = missed_fields .into_iter() .map(|idx| variant_data.fields()[idx].name.clone()) @@ -135,7 +134,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { let root = source_ptr.file_syntax(db.upcast()); if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) { if let Some(_) = record_pat.record_pat_field_list() { - let variant_data = variant_data(db.upcast(), variant_def); + let variant_data = variant_def.variant_data(db.upcast()); let missed_fields = missed_fields .into_iter() .map(|idx| variant_data.fields()[idx].name.clone()) @@ -453,7 +452,7 @@ pub fn record_literal_missing_fields( return None; } - let variant_data = variant_data(db.upcast(), variant_def); + let variant_data = variant_def.variant_data(db.upcast()); let specified_fields: FxHashSet<_> = fields.iter().map(|f| &f.name).collect(); let missed_fields: Vec = variant_data @@ -483,7 +482,7 @@ pub fn record_pattern_missing_fields( return None; } - let variant_data = variant_data(db.upcast(), variant_def); + let variant_data = variant_def.variant_data(db.upcast()); let specified_fields: FxHashSet<_> = fields.iter().map(|f| &f.name).collect(); let missed_fields: Vec = variant_data -- cgit v1.2.3