mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Explicitly check for reference locals or fields in Name classification
This commit is contained in:
parent
87621de2b9
commit
c65bb7f8b9
11 changed files with 67 additions and 50 deletions
|
@ -638,7 +638,7 @@ fn vars_used_in_body(ctx: &AssistContext, body: &FunctionBody) -> Vec<Local> {
|
|||
body.descendants()
|
||||
.filter_map(ast::NameRef::cast)
|
||||
.filter_map(|name_ref| NameRefClass::classify(&ctx.sema, &name_ref))
|
||||
.map(|name_kind| name_kind.referenced())
|
||||
.map(|name_kind| name_kind.referenced_local())
|
||||
.filter_map(|definition| match definition {
|
||||
Definition::Local(local) => Some(local),
|
||||
_ => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue