diff options
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/search.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index b843b5b57..cf78d3e41 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs | |||
@@ -256,21 +256,21 @@ impl Definition { | |||
256 | access: reference_access(&def, &name_ref), | 256 | access: reference_access(&def, &name_ref), |
257 | }); | 257 | }); |
258 | } | 258 | } |
259 | Some(NameRefClass::FieldShorthand { local, field: _ }) => { | 259 | Some(NameRefClass::FieldShorthand { local, field }) => { |
260 | let kind = match self { | 260 | match self { |
261 | Definition::StructField(_) => { | 261 | Definition::StructField(_) if &field == self => refs.push(Reference { |
262 | ReferenceKind::StructFieldShorthandForField | 262 | file_range: sema.original_range(name_ref.syntax()), |
263 | } | 263 | kind: ReferenceKind::StructFieldShorthandForField, |
264 | Definition::Local(_) => ReferenceKind::StructFieldShorthandForLocal, | 264 | access: reference_access(&field, &name_ref), |
265 | _ => continue, | 265 | }), |
266 | Definition::Local(l) if &local == l => refs.push(Reference { | ||
267 | file_range: sema.original_range(name_ref.syntax()), | ||
268 | kind: ReferenceKind::StructFieldShorthandForLocal, | ||
269 | access: reference_access(&Definition::Local(local), &name_ref), | ||
270 | }), | ||
271 | |||
272 | _ => {} // not a usage | ||
266 | }; | 273 | }; |
267 | |||
268 | let file_range = sema.original_range(name_ref.syntax()); | ||
269 | refs.push(Reference { | ||
270 | file_range, | ||
271 | kind, | ||
272 | access: reference_access(&Definition::Local(local), &name_ref), | ||
273 | }); | ||
274 | } | 274 | } |
275 | _ => {} // not a usage | 275 | _ => {} // not a usage |
276 | } | 276 | } |