diff options
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 2556c022b..e6663810d 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -491,12 +491,7 @@ impl AnalysisImpl { | |||
491 | let file = self.db.source_file(file_id); | 491 | let file = self.db.source_file(file_id); |
492 | let syntax = file.syntax(); | 492 | let syntax = file.syntax(); |
493 | let node = find_covering_node(syntax, range); | 493 | let node = find_covering_node(syntax, range); |
494 | let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); | 494 | let parent_fn = ctry!(node.ancestors().find_map(FnDef::cast)); |
495 | let parent_fn = if let Some(p) = parent_fn { | ||
496 | p | ||
497 | } else { | ||
498 | return Ok(None); | ||
499 | }; | ||
500 | let function = ctry!(source_binder::function_from_source( | 495 | let function = ctry!(source_binder::function_from_source( |
501 | &*self.db, file_id, parent_fn | 496 | &*self.db, file_id, parent_fn |
502 | )?); | 497 | )?); |