mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
Update crates/ide/src/references.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
parent
6001e7dfb1
commit
bd0eeb3f04
1 changed files with 4 additions and 13 deletions
|
@ -116,19 +116,10 @@ pub(crate) fn find_all_refs(
|
|||
|
||||
fn retain_import_usages(usages: &mut UsageSearchResult, sema: &Semantics<'_, RootDatabase>) {
|
||||
for (file_id, refs) in &mut usages.references {
|
||||
refs.retain(|x| {
|
||||
let file_sema = sema.parse(file_id.clone()).syntax().clone();
|
||||
|
||||
let maybe_node = file_sema.child_or_token_at_range(x.range.clone());
|
||||
|
||||
if let Some(node) = maybe_node {
|
||||
let res = match node {
|
||||
syntax::NodeOrToken::Node(x) => !matches!(x.kind(), USE),
|
||||
syntax::NodeOrToken::Token(_) => true,
|
||||
};
|
||||
res
|
||||
} else {
|
||||
true
|
||||
refs.retain(|it| {
|
||||
match if.name.as_name_ref() {
|
||||
Some(name_ref) => name_ref.syntax().ancestors().any(|it| !matches(it.kind(), USE)),
|
||||
None => true,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue