diff options
Diffstat (limited to 'crates/ra_analysis/src/completion')
-rw-r--r-- | crates/ra_analysis/src/completion/complete_dot.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/completion/complete_dot.rs b/crates/ra_analysis/src/completion/complete_dot.rs index ef3f4271b..54ce1b638 100644 --- a/crates/ra_analysis/src/completion/complete_dot.rs +++ b/crates/ra_analysis/src/completion/complete_dot.rs | |||
@@ -1,5 +1,3 @@ | |||
1 | use ra_db::LocalSyntaxPtr; | ||
2 | use ra_syntax::ast::AstNode; | ||
3 | use hir::{Ty, Def}; | 1 | use hir::{Ty, Def}; |
4 | 2 | ||
5 | use crate::Cancelable; | 3 | use crate::Cancelable; |
@@ -13,12 +11,10 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Ca | |||
13 | }; | 11 | }; |
14 | let infer_result = function.infer(ctx.db)?; | 12 | let infer_result = function.infer(ctx.db)?; |
15 | let syntax_mapping = function.body_syntax_mapping(ctx.db)?; | 13 | let syntax_mapping = function.body_syntax_mapping(ctx.db)?; |
16 | let expr = | 14 | let expr = match syntax_mapping.node_expr(receiver) { |
17 | if let Some(expr) = syntax_mapping.syntax_expr(LocalSyntaxPtr::new(receiver.syntax())) { | 15 | Some(expr) => expr, |
18 | expr | 16 | None => return Ok(()), |
19 | } else { | 17 | }; |
20 | return Ok(()); | ||
21 | }; | ||
22 | let receiver_ty = infer_result[expr].clone(); | 18 | let receiver_ty = infer_result[expr].clone(); |
23 | if !ctx.is_method_call { | 19 | if !ctx.is_method_call { |
24 | complete_fields(acc, ctx, receiver_ty)?; | 20 | complete_fields(acc, ctx, receiver_ty)?; |