aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-05-23 22:54:35 +0100
committerFlorian Diebold <[email protected]>2021-05-23 22:54:35 +0100
commitb8262099cc51065259daf10b4b23ff49ce74434f (patch)
treeb034786fe0a238914703191d5065a4c1ffc2d92c /crates/ide_completion
parente65803748d3a4c940b54071caa85b2b71e9d8697 (diff)
Get rid of field_type again
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/context.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index efaf4792f..1ec59ff80 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -339,13 +339,12 @@ impl<'a> CompletionContext<'a> {
339 cov_mark::hit!(expected_type_struct_field_without_leading_char); 339 cov_mark::hit!(expected_type_struct_field_without_leading_char);
340 // wouldn't try {} be nice... 340 // wouldn't try {} be nice...
341 (|| { 341 (|| {
342 let record_ty = self.sema.type_of_expr(&ast::Expr::cast(node.parent()?)?)?;
343 let expr_field = self.token.prev_sibling_or_token()? 342 let expr_field = self.token.prev_sibling_or_token()?
344 .into_node() 343 .into_node()
345 .and_then(|node| ast::RecordExprField::cast(node))?; 344 .and_then(|node| ast::RecordExprField::cast(node))?;
346 let field = self.sema.resolve_record_field(&expr_field)?.0; 345 let (_, _, ty) = self.sema.resolve_record_field(&expr_field)?;
347 Some(( 346 Some((
348 record_ty.field_type(self.db, field), 347 Some(ty),
349 expr_field.field_name().map(NameOrNameRef::NameRef), 348 expr_field.field_name().map(NameOrNameRef::NameRef),
350 )) 349 ))
351 })().unwrap_or((None, None)) 350 })().unwrap_or((None, None))