From 8d4be829e09dae4af7b4a82b379fdb8700b0929f Mon Sep 17 00:00:00 2001 From: unexge Date: Sun, 4 Apr 2021 00:04:31 +0300 Subject: Add convert tuple struct to named struct assist --- crates/ide_db/src/search.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/ide_db/src') diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 02f5e514b..90e4e7b03 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs @@ -430,6 +430,15 @@ impl<'a> FindUsages<'a> { sink: &mut dyn FnMut(FileId, FileReference) -> bool, ) -> bool { match NameRefClass::classify(self.sema, &name_ref) { + Some(NameRefClass::Definition(def)) if &def == self.def => { + let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); + let reference = FileReference { + range, + name: ast::NameLike::NameRef(name_ref.clone()), + access: reference_access(&def, &name_ref), + }; + sink(file_id, reference) + } Some(NameRefClass::Definition(Definition::SelfType(impl_))) => { let ty = impl_.self_ty(self.sema.db); @@ -448,15 +457,6 @@ impl<'a> FindUsages<'a> { false } - Some(NameRefClass::Definition(def)) if &def == self.def => { - let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); - let reference = FileReference { - range, - name: ast::NameLike::NameRef(name_ref.clone()), - access: reference_access(&def, &name_ref), - }; - sink(file_id, reference) - } Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => { let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); let reference = match self.def { -- cgit v1.2.3