mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
generalize impl_froms to nested enums
This commit is contained in:
parent
45117c6388
commit
bcf30d389c
4 changed files with 26 additions and 58 deletions
|
@ -139,7 +139,7 @@ pub enum ModuleDef {
|
|||
impl_froms!(
|
||||
ModuleDef: Module,
|
||||
Function,
|
||||
AdtDef,
|
||||
AdtDef(Struct, Enum, Union),
|
||||
EnumVariant,
|
||||
Const,
|
||||
Static,
|
||||
|
@ -148,24 +148,6 @@ impl_froms!(
|
|||
BuiltinType
|
||||
);
|
||||
|
||||
impl From<Struct> for ModuleDef {
|
||||
fn from(it: Struct) -> ModuleDef {
|
||||
ModuleDef::AdtDef(AdtDef::Struct(it))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Enum> for ModuleDef {
|
||||
fn from(it: Enum) -> ModuleDef {
|
||||
ModuleDef::AdtDef(AdtDef::Enum(it))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Union> for ModuleDef {
|
||||
fn from(it: Union) -> ModuleDef {
|
||||
ModuleDef::AdtDef(AdtDef::Union(it))
|
||||
}
|
||||
}
|
||||
|
||||
pub enum ModuleSource {
|
||||
SourceFile(ast::SourceFile),
|
||||
Module(ast::Module),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue