aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-12-24 15:44:32 +0000
committerFlorian Diebold <[email protected]>2019-12-24 16:29:27 +0000
commitc39352fa43f4ff4df835d511b4415c8e770438c4 (patch)
treecb7daa51f218a87aa94874aef28130c1ca2b0245 /crates/ra_hir
parentaa49b79bda5b7cafbaa33c302a9974133d34c52b (diff)
Fill in type params in 'add missing impl members' assist
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs11
1 files changed, 11 insertions, 0 deletions
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!(
644 Const 644 Const
645); 645);
646 646
647impl GenericDef {
648 pub fn params(self, db: &impl HirDatabase) -> Vec<TypeParam> {
649 let generics: Arc<hir_def::generics::GenericParams> = db.generic_params(self.into());
650 generics
651 .types
652 .iter()
653 .map(|(local_id, _)| TypeParam { id: TypeParamId { parent: self.into(), local_id } })
654 .collect()
655 }
656}
657
647#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] 658#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
648pub struct Local { 659pub struct Local {
649 pub(crate) parent: DefWithBody, 660 pub(crate) parent: DefWithBody,