From 7f09083c6ff3cb3499b140ffe85f83a06f685aed Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 29 Feb 2020 18:35:45 +0100 Subject: Handle tuple fields as well --- crates/ra_hir/src/semantics.rs | 1 + crates/ra_hir/src/semantics/source_to_def.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 60392947e..74901e318 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -268,6 +268,7 @@ to_def_impls![ (crate::Static, ast::StaticDef, static_to_def), (crate::Function, ast::FnDef, fn_to_def), (crate::StructField, ast::RecordFieldDef, record_field_to_def), + (crate::StructField, ast::TupleFieldDef, tuple_field_to_def), (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), (crate::TypeParam, ast::TypeParam, type_param_to_def), (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 303610dc4..884b535b2 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -94,13 +94,18 @@ impl SourceToDefCtx<'_, &'_ DB> { ) -> Option { self.to_def(src, keys::TYPE_ALIAS) } - //TODO: tuple field pub(super) fn record_field_to_def( &mut self, src: InFile, ) -> Option { self.to_def(src, keys::RECORD_FIELD) } + pub(super) fn tuple_field_to_def( + &mut self, + src: InFile, + ) -> Option { + self.to_def(src, keys::TUPLE_FIELD) + } pub(super) fn enum_variant_to_def( &mut self, src: InFile, -- cgit v1.2.3