From a55ad203888b5e43cf6cbf015d562d7bd1abe0bb Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Thu, 14 May 2020 09:56:20 +0300 Subject: Use generic_defaults and display_source_code --- crates/ra_hir/src/code_model.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 3c56f39c1..3936f5aaa 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -990,9 +990,10 @@ impl TypeParam { } } - pub fn default(self, db: &dyn HirDatabase) -> Option { - let params = db.generic_params(self.id.parent); - params.types[self.id.local_id].default.clone() + pub fn default(self, db: &dyn HirDatabase) -> Option { + let params = db.generic_defaults(self.id.parent); + let local_idx: u32 = self.id.local_id.into_raw().into(); + params.get(local_idx as usize).map(|d| d.clone()) } } -- cgit v1.2.3