mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
classify definition of a function right
This commit is contained in:
parent
79e6b3b0d1
commit
0dd08b8023
@ -221,6 +221,9 @@ impl HasDefinition for AssocItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> {
|
fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> {
|
||||||
|
if def.syntax().parent().and_then(ast::ItemList::cast).is_none() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
let src = hir::Source { file_id, ast: def };
|
let src = hir::Source { file_id, ast: def };
|
||||||
let item = AssocItem::from_source(db, src)?;
|
let item = AssocItem::from_source(db, src)?;
|
||||||
Some(item.definition(db))
|
Some(item.definition(db))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user