diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 15:19:40 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 15:19:40 +0000 |
commit | 91feed736f91a3790b2f5a5d0d879c06843bce95 (patch) | |
tree | 6a71bcb433b82e4c473238d439aad2ef76144157 /crates/ra_ide_api/src/goto_definition.rs | |
parent | a36b2cf377a90cf13bb097e57878b8384d30c53a (diff) | |
parent | fb012e5c1e49af73b480127bcf56d8f5993b8032 (diff) |
Merge #550
550: remove Cancelable from source binders r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 332a2fb8d..591f36cce 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -48,7 +48,7 @@ pub(crate) fn reference_definition( | |||
48 | ) -> Cancelable<ReferenceResult> { | 48 | ) -> Cancelable<ReferenceResult> { |
49 | use self::ReferenceResult::*; | 49 | use self::ReferenceResult::*; |
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 |
@@ -77,8 +77,7 @@ pub(crate) fn reference_definition( | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | // Then try module name resolution | 79 | // Then try module name resolution |
80 | if let Some(module) = | 80 | if let Some(module) = hir::source_binder::module_from_child_node(db, file_id, name_ref.syntax()) |
81 | hir::source_binder::module_from_child_node(db, file_id, name_ref.syntax())? | ||
82 | { | 81 | { |
83 | if let Some(path) = name_ref | 82 | if let Some(path) = name_ref |
84 | .syntax() | 83 | .syntax() |
@@ -96,7 +95,7 @@ pub(crate) fn reference_definition( | |||
96 | } | 95 | } |
97 | // If that fails try the index based approach. | 96 | // If that fails try the index based approach. |
98 | let navs = db | 97 | let navs = db |
99 | .index_resolve(name_ref)? | 98 | .index_resolve(name_ref) |
100 | .into_iter() | 99 | .into_iter() |
101 | .map(NavigationTarget::from_symbol) | 100 | .map(NavigationTarget::from_symbol) |
102 | .collect(); | 101 | .collect(); |
@@ -111,7 +110,7 @@ fn name_definition( | |||
111 | if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { | 110 | if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { |
112 | if module.has_semi() { | 111 | if module.has_semi() { |
113 | if let Some(child_module) = | 112 | if let Some(child_module) = |
114 | hir::source_binder::module_from_declaration(db, file_id, module)? | 113 | hir::source_binder::module_from_declaration(db, file_id, module) |
115 | { | 114 | { |
116 | let nav = NavigationTarget::from_module(db, child_module)?; | 115 | let nav = NavigationTarget::from_module(db, child_module)?; |
117 | return Ok(Some(vec![nav])); | 116 | return Ok(Some(vec![nav])); |