diff options
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 4e0631679..f2912d235 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -516,8 +516,14 @@ impl AnalysisImpl { | |||
516 | let syntax = file.syntax(); | 516 | let syntax = file.syntax(); |
517 | let node = find_covering_node(syntax, range); | 517 | let node = find_covering_node(syntax, range); |
518 | let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); | 518 | let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); |
519 | let parent_fn = if let Some(p) = parent_fn { p } else { return Ok(None) }; | 519 | let parent_fn = if let Some(p) = parent_fn { |
520 | let function = ctry!(source_binder::function_from_source(&*self.db, file_id, parent_fn)?); | 520 | p |
521 | } else { | ||
522 | return Ok(None); | ||
523 | }; | ||
524 | let function = ctry!(source_binder::function_from_source( | ||
525 | &*self.db, file_id, parent_fn | ||
526 | )?); | ||
521 | let infer = function.infer(&*self.db); | 527 | let infer = function.infer(&*self.db); |
522 | Ok(infer.type_of_node(node).map(|t| t.to_string())) | 528 | Ok(infer.type_of_node(node).map(|t| t.to_string())) |
523 | } | 529 | } |