diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index b08880cdf07..46d713a7b1d 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -459,9 +459,8 @@ fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { let local_id = self.db.struct_data(*s).variant_data.field(name)?; let field = FieldId { parent: (*s).into(), local_id }; - let is_visible_in_ctx = is_visible(&field); - self.write_field_resolution(tgt_expr, field); - if is_visible_in_ctx { + if is_visible(&field) { + self.write_field_resolution(tgt_expr, field); Some( self.db.field_types((*s).into())[field.local_id] .clone() @@ -474,9 +473,8 @@ fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { TyKind::Adt(AdtId(hir_def::AdtId::UnionId(u)), parameters) => { let local_id = self.db.union_data(*u).variant_data.field(name)?; let field = FieldId { parent: (*u).into(), local_id }; - let is_visible_in_ctx = is_visible(&field); - self.write_field_resolution(tgt_expr, field); - if is_visible_in_ctx { + if is_visible(&field) { + self.write_field_resolution(tgt_expr, field); Some( self.db.field_types((*u).into())[field.local_id] .clone()