Various small code review improvements

This commit is contained in:
Florian Diebold 2019-01-06 00:33:58 +01:00
parent 8e3e5ab2c8
commit e5a6cf8153
3 changed files with 27 additions and 26 deletions

View file

@ -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)
}