From 970dbf871795650ecf49b7198d53bdcad9c612af Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Apr 2020 14:23:34 +0200 Subject: Rename StructField -> Field --- crates/ra_hir_ty/src/infer/expr.rs | 8 +++----- crates/ra_hir_ty/src/infer/pat.rs | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_ty/src/infer') diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 1fdb235a0..83f946eee 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs @@ -8,7 +8,7 @@ use hir_def::{ expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, path::{GenericArg, GenericArgs}, resolver::resolver_for_expr, - AdtId, AssocContainerId, Lookup, StructFieldId, + AdtId, AssocContainerId, FieldId, Lookup, }; use hir_expand::name::Name; use ra_syntax::ast::RangeOp; @@ -216,9 +216,7 @@ impl<'a> InferenceContext<'a> { for (field_idx, field) in fields.iter().enumerate() { let field_def = variant_data.as_ref().and_then(|it| match it.field(&field.name) { - Some(local_id) => { - Some(StructFieldId { parent: def_id.unwrap(), local_id }) - } + Some(local_id) => Some(FieldId { parent: def_id.unwrap(), local_id }), None => { self.push_diagnostic(InferenceDiagnostic::NoSuchField { expr: tgt_expr, @@ -257,7 +255,7 @@ impl<'a> InferenceContext<'a> { .and_then(|idx| a_ty.parameters.0.get(idx).cloned()), TypeCtor::Adt(AdtId::StructId(s)) => { self.db.struct_data(s).variant_data.field(name).map(|local_id| { - let field = StructFieldId { parent: s.into(), local_id }; + let field = FieldId { parent: s.into(), local_id }; self.write_field_resolution(tgt_expr, field); self.db.field_types(s.into())[field.local_id] .clone() diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs index 7c2ad4384..54ec870df 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/ra_hir_ty/src/infer/pat.rs @@ -7,7 +7,7 @@ use hir_def::{ expr::{BindingAnnotation, Pat, PatId, RecordFieldPat}, path::Path, type_ref::Mutability, - StructFieldId, + FieldId, }; use hir_expand::name::Name; use test_utils::tested_by; @@ -69,7 +69,7 @@ impl<'a> InferenceContext<'a> { for subpat in subpats { let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name)); if let Some(local_id) = matching_field { - let field_def = StructFieldId { parent: def.unwrap(), local_id }; + let field_def = FieldId { parent: def.unwrap(), local_id }; self.result.record_field_pat_resolutions.insert(subpat.pat, field_def); } -- cgit v1.2.3