mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
classify definition of a function right
This commit is contained in:
parent
79e6b3b0d1
commit
0dd08b8023
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue