mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
simplify
This commit is contained in:
parent
58a631f39a
commit
bc833216d7
1 changed files with 1 additions and 6 deletions
|
@ -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
|
||||
)?);
|
||||
|
|
Loading…
Reference in a new issue