mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add NavigationTarget::from_impl_item
This commit is contained in:
parent
ad2da5b1da
commit
e1b59bfe0b
2 changed files with 22 additions and 14 deletions
|
@ -5,7 +5,7 @@ use ra_syntax::{
|
|||
SyntaxNode,
|
||||
};
|
||||
use test_utils::tested_by;
|
||||
use hir::{ImplItem, Resolution};
|
||||
use hir::Resolution;
|
||||
|
||||
use crate::{FilePosition, NavigationTarget, db::RootDatabase, RangeInfo};
|
||||
|
||||
|
@ -138,18 +138,7 @@ pub(crate) fn reference_definition(
|
|||
.node_expr(expr)
|
||||
.and_then(|it| infer_result.assoc_resolutions(it.into()))
|
||||
{
|
||||
match res {
|
||||
ImplItem::Method(f) => {
|
||||
return Exact(NavigationTarget::from_function(db, f));
|
||||
}
|
||||
ImplItem::Const(c) => {
|
||||
let (file, node) = c.source(db);
|
||||
let file = file.original_file(db);
|
||||
let node = &*node;
|
||||
return Exact(NavigationTarget::from_named(file, node));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
return Exact(NavigationTarget::from_impl_item(db, res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue