From c39352fa43f4ff4df835d511b4415c8e770438c4 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 24 Dec 2019 16:44:32 +0100 Subject: Fill in type params in 'add missing impl members' assist --- crates/ra_hir/src/code_model.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index bcfc0d03e..76d8f85f1 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -644,6 +644,17 @@ impl_froms!( Const ); +impl GenericDef { + pub fn params(self, db: &impl HirDatabase) -> Vec { + let generics: Arc = db.generic_params(self.into()); + generics + .types + .iter() + .map(|(local_id, _)| TypeParam { id: TypeParamId { parent: self.into(), local_id } }) + .collect() + } +} + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct Local { pub(crate) parent: DefWithBody, -- cgit v1.2.3