From bc833216d7190d7a270ed2d831abc134fab91cfb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 00:08:33 +0300 Subject: simplify --- crates/ra_analysis/src/imp.rs | 7 +------ 1 file changed, 1 insertion(+), 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 { let file = self.db.source_file(file_id); let syntax = file.syntax(); let node = find_covering_node(syntax, range); - let parent_fn = node.ancestors().filter_map(FnDef::cast).next(); - let parent_fn = if let Some(p) = parent_fn { - p - } else { - return Ok(None); - }; + let parent_fn = ctry!(node.ancestors().find_map(FnDef::cast)); let function = ctry!(source_binder::function_from_source( &*self.db, file_id, parent_fn )?); -- cgit v1.2.3