Explicitly check for reference locals or fields in Name classification

This commit is contained in:
Lukas Wirth 2021-07-11 14:03:35 +02:00
parent 87621de2b9
commit c65bb7f8b9
11 changed files with 67 additions and 50 deletions

View file

@ -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,