aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_dot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_dot.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index 30a0a3924..31a2478d1 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -9,7 +9,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Ca
9 (Some(function), Some(receiver)) => (function, receiver), 9 (Some(function), Some(receiver)) => (function, receiver),
10 _ => return Ok(()), 10 _ => return Ok(()),
11 }; 11 };
12 let infer_result = function.infer(ctx.db)?; 12 let infer_result = function.infer(ctx.db);
13 let syntax_mapping = function.body_syntax_mapping(ctx.db); 13 let syntax_mapping = function.body_syntax_mapping(ctx.db);
14 let expr = match syntax_mapping.node_expr(receiver) { 14 let expr = match syntax_mapping.node_expr(receiver) {
15 Some(expr) => expr, 15 Some(expr) => expr,
@@ -19,7 +19,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Ca
19 if !ctx.is_call { 19 if !ctx.is_call {
20 complete_fields(acc, ctx, receiver_ty.clone()); 20 complete_fields(acc, ctx, receiver_ty.clone());
21 } 21 }
22 complete_methods(acc, ctx, receiver_ty)?; 22 complete_methods(acc, ctx, receiver_ty);
23 Ok(()) 23 Ok(())
24} 24}
25 25
@@ -55,11 +55,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
55 } 55 }
56} 56}
57 57
58fn complete_methods( 58fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) {
59 acc: &mut Completions,
60 ctx: &CompletionContext,
61 receiver: Ty,
62) -> Cancelable<()> {
63 receiver.iterate_methods(ctx.db, |func| { 59 receiver.iterate_methods(ctx.db, |func| {
64 let sig = func.signature(ctx.db); 60 let sig = func.signature(ctx.db);
65 if sig.has_self_param() { 61 if sig.has_self_param() {
@@ -68,9 +64,8 @@ fn complete_methods(
68 .kind(CompletionItemKind::Method) 64 .kind(CompletionItemKind::Method)
69 .add_to(acc); 65 .add_to(acc);
70 } 66 }
71 Ok(None::<()>) 67 None::<()>
72 })?; 68 });
73 Ok(())
74} 69}
75 70
76#[cfg(test)] 71#[cfg(test)]