mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
rename AdtDef -> Adt
This commit is contained in:
parent
bcf30d389c
commit
114a1b878e
20 changed files with 90 additions and 99 deletions
|
@ -127,7 +127,7 @@ impl BuiltinType {
|
|||
pub enum ModuleDef {
|
||||
Module(Module),
|
||||
Function(Function),
|
||||
AdtDef(AdtDef),
|
||||
Adt(Adt),
|
||||
// Can't be directly declared, but can be imported.
|
||||
EnumVariant(EnumVariant),
|
||||
Const(Const),
|
||||
|
@ -139,7 +139,7 @@ pub enum ModuleDef {
|
|||
impl_froms!(
|
||||
ModuleDef: Module,
|
||||
Function,
|
||||
AdtDef(Struct, Enum, Union),
|
||||
Adt(Struct, Enum, Union),
|
||||
EnumVariant,
|
||||
Const,
|
||||
Static,
|
||||
|
@ -496,37 +496,38 @@ impl EnumVariant {
|
|||
}
|
||||
}
|
||||
|
||||
/// A Data Type
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum AdtDef {
|
||||
pub enum Adt {
|
||||
Struct(Struct),
|
||||
Union(Union),
|
||||
Enum(Enum),
|
||||
}
|
||||
impl_froms!(AdtDef: Struct, Union, Enum);
|
||||
impl_froms!(Adt: Struct, Union, Enum);
|
||||
|
||||
impl AdtDef {
|
||||
impl Adt {
|
||||
pub fn ty(self, db: &impl HirDatabase) -> Ty {
|
||||
match self {
|
||||
AdtDef::Struct(it) => it.ty(db),
|
||||
AdtDef::Union(it) => it.ty(db),
|
||||
AdtDef::Enum(it) => it.ty(db),
|
||||
Adt::Struct(it) => it.ty(db),
|
||||
Adt::Union(it) => it.ty(db),
|
||||
Adt::Enum(it) => it.ty(db),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
|
||||
match self {
|
||||
AdtDef::Struct(s) => s.module(db),
|
||||
AdtDef::Union(s) => s.module(db),
|
||||
AdtDef::Enum(e) => e.module(db),
|
||||
Adt::Struct(s) => s.module(db),
|
||||
Adt::Union(s) => s.module(db),
|
||||
Adt::Enum(e) => e.module(db),
|
||||
}
|
||||
.krate(db)
|
||||
}
|
||||
|
||||
pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
|
||||
match self {
|
||||
AdtDef::Struct(it) => it.resolver(db),
|
||||
AdtDef::Union(it) => it.resolver(db),
|
||||
AdtDef::Enum(it) => it.resolver(db),
|
||||
Adt::Struct(it) => it.resolver(db),
|
||||
Adt::Union(it) => it.resolver(db),
|
||||
Adt::Enum(it) => it.resolver(db),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue