diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 16:06:52 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 16:06:52 +0000 |
commit | 72a4951023f11adfdf0eac353c99d8a01a9471fc (patch) | |
tree | 8cca098650d989ea58e6bd4aafd44e5ff85fcee5 /crates/ra_ide_api/src | |
parent | 7c977a7dcd2bac3b6148f2428bcb586c6354d775 (diff) | |
parent | 18e9a710cd2f2ced84fde19e88d0b967dcb5939e (diff) |
Merge #553
553: remove Cancelable from fn_scopes r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/imp.rs | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 886dc54d4..cb86ba9a3 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Ca | |||
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, |
16 | None => return Ok(()), | 16 | None => return Ok(()), |
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index f422bb9a7..fdb64895e 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -15,7 +15,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) -> | |||
15 | None => return Ok(()), | 15 | None => return Ok(()), |
16 | }; | 16 | }; |
17 | if let Some(function) = &ctx.function { | 17 | if let Some(function) = &ctx.function { |
18 | let scopes = function.scopes(ctx.db)?; | 18 | let scopes = function.scopes(ctx.db); |
19 | complete_fn(acc, &scopes, ctx.offset); | 19 | complete_fn(acc, &scopes, ctx.offset); |
20 | } | 20 | } |
21 | 21 | ||
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 7229293a4..5d522181b 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -50,7 +50,7 @@ pub(crate) fn reference_definition( | |||
50 | if let Some(function) = | 50 | if let Some(function) = |
51 | hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) | 51 | hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) |
52 | { | 52 | { |
53 | let scope = function.scopes(db)?; | 53 | let scope = function.scopes(db); |
54 | // First try to resolve the symbol locally | 54 | // First try to resolve the symbol locally |
55 | if let Some(entry) = scope.resolve_local_name(name_ref) { | 55 | if let Some(entry) = scope.resolve_local_name(name_ref) { |
56 | let nav = NavigationTarget::from_scope_entry(file_id, &entry); | 56 | let nav = NavigationTarget::from_scope_entry(file_id, &entry); |
@@ -64,7 +64,7 @@ pub(crate) fn reference_definition( | |||
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 |
70 | .node_expr(expr) | 70 | .node_expr(expr) |
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 26f3ced70..0e9c48421 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -74,7 +74,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Cancelable<Option | |||
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())) |
80 | } else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) { | 80 | } else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) { |
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index 3ef11dfa1..8b2cd6e27 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs | |||
@@ -128,7 +128,7 @@ impl db::RootDatabase { | |||
128 | .collect::<Vec<_>>(); | 128 | .collect::<Vec<_>>(); |
129 | ret.extend( | 129 | ret.extend( |
130 | descr | 130 | descr |
131 | .scopes(self)? | 131 | .scopes(self) |
132 | .find_all_refs(binding) | 132 | .find_all_refs(binding) |
133 | .into_iter() | 133 | .into_iter() |
134 | .map(|ref_desc| (position.file_id, ref_desc.range)), | 134 | .map(|ref_desc| (position.file_id, ref_desc.range)), |
@@ -156,7 +156,7 @@ impl db::RootDatabase { | |||
156 | position.file_id, | 156 | position.file_id, |
157 | name_ref.syntax(), | 157 | name_ref.syntax(), |
158 | )); | 158 | )); |
159 | let scope = descr.scopes(db)?; | 159 | let scope = descr.scopes(db); |
160 | let resolved = ctry!(scope.resolve_local_name(name_ref)); | 160 | let resolved = ctry!(scope.resolve_local_name(name_ref)); |
161 | let resolved = resolved.ptr().resolve(source_file); | 161 | let resolved = resolved.ptr().resolve(source_file); |
162 | let binding = ctry!(find_node_at_offset::<ast::BindPat>( | 162 | let binding = ctry!(find_node_at_offset::<ast::BindPat>( |