mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Various small code review improvements
This commit is contained in:
parent
8e3e5ab2c8
commit
e5a6cf8153
3 changed files with 27 additions and 26 deletions
|
@ -92,12 +92,10 @@ pub fn function_from_position(
|
|||
position: FilePosition,
|
||||
) -> Cancelable<Option<Function>> {
|
||||
let file = db.source_file(position.file_id);
|
||||
let fn_def = if let Some(f) = find_node_at_offset::<ast::FnDef>(file.syntax(), position.offset)
|
||||
{
|
||||
f
|
||||
} else {
|
||||
return Ok(None);
|
||||
};
|
||||
let fn_def = ctry!(find_node_at_offset::<ast::FnDef>(
|
||||
file.syntax(),
|
||||
position.offset
|
||||
));
|
||||
function_from_source(db, position.file_id, fn_def)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue