aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db
diff options
context:
space:
mode:
authorMatt Niemeir <[email protected]>2020-03-11 03:27:38 +0000
committerMatt Niemeir <[email protected]>2020-03-11 03:27:38 +0000
commit13ccbb2919dff8e98d0a242d9d6b7edd17a6bd2c (patch)
tree4c8fb108cce727f0386c543cf4e9867803495f0d /crates/ra_ide_db
parentce8121bd65daecd9e92371c244dd1ac2b0e5ecda (diff)
find_usages limited to actual usages again
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r--crates/ra_ide_db/src/search.rs28
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 }