mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Use GenericDefId more
This commit is contained in:
parent
9f7fcc6ecd
commit
c2a16632d0
5 changed files with 20 additions and 33 deletions
|
@ -9,9 +9,8 @@ use hir_def::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
ty::{CallableDef, TypableDef},
|
||||
Adt, AssocItem, AttrDef, Const, Crate, DefWithBody, EnumVariant, Function, GenericDef,
|
||||
ModuleDef, Static, StructField, TypeAlias, VariantDef,
|
||||
ty::TypableDef, Adt, AssocItem, AttrDef, Const, Crate, DefWithBody, EnumVariant, Function,
|
||||
GenericDef, ModuleDef, Static, StructField, TypeAlias, VariantDef,
|
||||
};
|
||||
|
||||
impl From<ra_db::CrateId> for Crate {
|
||||
|
@ -214,18 +213,6 @@ impl From<Adt> for GenericDefId {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<CallableDef> for GenericDefId {
|
||||
fn from(def: CallableDef) -> Self {
|
||||
match def {
|
||||
CallableDef::Function(it) => it.id.into(),
|
||||
CallableDef::Struct(it) => it.id.into(),
|
||||
CallableDef::EnumVariant(it) => {
|
||||
EnumVariantId { parent: it.parent.id, local_id: it.id }.into()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VariantDef> for VariantId {
|
||||
fn from(def: VariantDef) -> Self {
|
||||
match def {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue