mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Use hir::GenericParam in ide_db::Definition instead of relisting all 3
This commit is contained in:
parent
6a0a47dd14
commit
b795128dde
9 changed files with 65 additions and 42 deletions
|
@ -1263,6 +1263,24 @@ pub enum GenericParam {
|
|||
}
|
||||
impl_from!(TypeParam, LifetimeParam, ConstParam for GenericParam);
|
||||
|
||||
impl GenericParam {
|
||||
pub fn module(self, db: &dyn HirDatabase) -> Module {
|
||||
match self {
|
||||
GenericParam::TypeParam(it) => it.module(db),
|
||||
GenericParam::LifetimeParam(it) => it.module(db),
|
||||
GenericParam::ConstParam(it) => it.module(db),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(self, db: &dyn HirDatabase) -> Name {
|
||||
match self {
|
||||
GenericParam::TypeParam(it) => it.name(db),
|
||||
GenericParam::LifetimeParam(it) => it.name(db),
|
||||
GenericParam::ConstParam(it) => it.name(db),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct TypeParam {
|
||||
pub(crate) id: TypeParamId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue