mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 15:56:09 +03:00
simplify
This commit is contained in:
@@ -491,12 +491,7 @@ pub fn type_of(&self, file_id: FileId, range: TextRange) -> Cancelable<Option<St
|
||||
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
|
||||
)?);
|
||||
|
||||
Reference in New Issue
Block a user