From 8bcbcc454cbb48b897083c122566c0b4c2b780aa Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 14 Apr 2019 13:07:45 +0200 Subject: Extract generic_params method to a HasGenericParams trait --- crates/ra_hir/src/code_model_api.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'crates/ra_hir/src/code_model_api.rs') diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 28de9e76a..8f1ed1086 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs @@ -11,7 +11,7 @@ use crate::{ expr::{Body, BodySourceMap}, ty::InferenceResult, adt::{EnumVariantId, StructFieldId, VariantDef}, - generics::GenericParams, + generics::HasGenericParams, docs::{Documentation, Docs, docs_from_ast}, ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId}, impl_block::ImplBlock, @@ -299,10 +299,6 @@ impl Struct { .map(|(id, _)| StructField { parent: (*self).into(), id }) } - pub fn generic_params(&self, db: &impl DefDatabase) -> Arc { - db.generic_params((*self).into()) - } - pub fn ty(&self, db: &impl HirDatabase) -> Ty { db.type_for_def((*self).into(), Namespace::Types) } @@ -363,10 +359,6 @@ impl Enum { .map(|(id, _)| EnumVariant { parent: *self, id }) } - pub fn generic_params(&self, db: &impl DefDatabase) -> Arc { - db.generic_params((*self).into()) - } - pub fn ty(&self, db: &impl HirDatabase) -> Ty { db.type_for_def((*self).into(), Namespace::Types) } @@ -537,10 +529,6 @@ impl Function { db.infer((*self).into()) } - pub fn generic_params(&self, db: &impl DefDatabase) -> Arc { - db.generic_params((*self).into()) - } - /// The containing impl block, if this is a method. pub fn impl_block(&self, db: &impl DefDatabase) -> Option { let module_impls = db.impls_in_module(self.module(db)); @@ -696,10 +684,6 @@ impl Trait { self.id.module(db) } - pub fn generic_params(&self, db: &impl DefDatabase) -> Arc { - db.generic_params((*self).into()) - } - pub fn name(self, db: &impl DefDatabase) -> Option { self.trait_data(db).name().clone() } @@ -737,10 +721,6 @@ impl TypeAlias { self.id.source(db) } - pub fn generic_params(&self, db: &impl DefDatabase) -> Arc { - db.generic_params((*self).into()) - } - pub fn module(&self, db: &impl DefDatabase) -> Module { self.id.module(db) } -- cgit v1.2.3