mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Remove ty from code_model
This commit is contained in:
parent
b77d7c24aa
commit
b37c6a746b
9 changed files with 53 additions and 55 deletions
|
@ -9,16 +9,10 @@ use hir_def::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
Adt, AssocItem, AttrDef, Crate, DefWithBody, EnumVariant, GenericDef, ModuleDef, StructField,
|
||||
Adt, AssocItem, AttrDef, DefWithBody, EnumVariant, GenericDef, ModuleDef, StructField,
|
||||
VariantDef,
|
||||
};
|
||||
|
||||
impl From<ra_db::CrateId> for Crate {
|
||||
fn from(id: ra_db::CrateId) -> Self {
|
||||
Crate { id }
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! from_id {
|
||||
($(($id:path, $ty:path)),*) => {$(
|
||||
impl From<$id> for $ty {
|
||||
|
@ -26,10 +20,16 @@ macro_rules! from_id {
|
|||
$ty { id }
|
||||
}
|
||||
}
|
||||
impl From<$ty> for $id {
|
||||
fn from(ty: $ty) -> $id {
|
||||
ty.id
|
||||
}
|
||||
}
|
||||
)*}
|
||||
}
|
||||
|
||||
from_id![
|
||||
(ra_db::CrateId, crate::Crate),
|
||||
(hir_def::ModuleId, crate::Module),
|
||||
(hir_def::StructId, crate::Struct),
|
||||
(hir_def::UnionId, crate::Union),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue