diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 15 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 2 |
3 files changed, 7 insertions, 12 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 | ||
58 | fn complete_methods( | 58 | fn 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)] |
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index cdd8e211d..e0f3deb0b 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -63,7 +63,7 @@ pub(crate) fn reference_definition( | |||
63 | .parent() | 63 | .parent() |
64 | .and_then(ast::MethodCallExpr::cast) | 64 | .and_then(ast::MethodCallExpr::cast) |
65 | { | 65 | { |
66 | let infer_result = function.infer(db)?; | 66 | let infer_result = function.infer(db); |
67 | let syntax_mapping = function.body_syntax_mapping(db); | 67 | let syntax_mapping = function.body_syntax_mapping(db); |
68 | let expr = ast::Expr::cast(method_call.syntax()).unwrap(); | 68 | let expr = ast::Expr::cast(method_call.syntax()).unwrap(); |
69 | if let Some(def_id) = syntax_mapping | 69 | if let Some(def_id) = syntax_mapping |
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 0e9c48421..6b5887bda 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -73,7 +73,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Cancelable<Option | |||
73 | frange.file_id, | 73 | frange.file_id, |
74 | parent_fn | 74 | parent_fn |
75 | )); | 75 | )); |
76 | let infer = function.infer(db)?; | 76 | let infer = function.infer(db); |
77 | let syntax_mapping = function.body_syntax_mapping(db); | 77 | let syntax_mapping = function.body_syntax_mapping(db); |
78 | if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) { | 78 | if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) { |
79 | Ok(Some(infer[expr].to_string())) | 79 | Ok(Some(infer[expr].to_string())) |