From 1692f07393dba4f5c122df1a609d5b18751bf406 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 7 Dec 2019 18:48:35 +0100 Subject: ToNav for GenericParam --- crates/ra_hir/src/code_model.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 29ace8479..8833750c8 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -860,6 +860,13 @@ pub struct GenericParam { pub(crate) id: GenericParamId, } +impl GenericParam { + pub fn name(self, db: &impl HirDatabase) -> Name { + let params = db.generic_params(self.id.parent); + params.params[self.id.local_id].name.clone() + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ImplBlock { pub(crate) id: ImplId, -- cgit v1.2.3