aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/completion/complete_dot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/completion/complete_dot.rs')
-rw-r--r--crates/ra_analysis/src/completion/complete_dot.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_analysis/src/completion/complete_dot.rs b/crates/ra_analysis/src/completion/complete_dot.rs
index 93d657576..f24835d17 100644
--- a/crates/ra_analysis/src/completion/complete_dot.rs
+++ b/crates/ra_analysis/src/completion/complete_dot.rs
@@ -6,20 +6,9 @@ use crate::completion::{CompletionContext, Completions, CompletionKind, Completi
6 6
7/// Complete dot accesses, i.e. fields or methods (currently only fields). 7/// Complete dot accesses, i.e. fields or methods (currently only fields).
8pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Cancelable<()> { 8pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Cancelable<()> {
9 let module = if let Some(module) = &ctx.module { 9 let (function, receiver) = match (&ctx.function, ctx.dot_receiver) {
10 module 10 (Some(function), Some(receiver)) => (function, receiver),
11 } else { 11 _ => return Ok(()),
12 return Ok(());
13 };
14 let function = if let Some(fn_def) = ctx.enclosing_fn {
15 hir::source_binder::function_from_module(ctx.db, module, fn_def)
16 } else {
17 return Ok(());
18 };
19 let receiver = if let Some(receiver) = ctx.dot_receiver {
20 receiver
21 } else {
22 return Ok(());
23 }; 12 };
24 let infer_result = function.infer(ctx.db)?; 13 let infer_result = function.infer(ctx.db)?;
25 let receiver_ty = if let Some(ty) = infer_result.type_of_node(receiver.syntax()) { 14 let receiver_ty = if let Some(ty) = infer_result.type_of_node(receiver.syntax()) {