mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
macro-generate froms
This commit is contained in:
parent
aea1f95a66
commit
a7c0336a75
4 changed files with 17 additions and 78 deletions
|
@ -29,24 +29,7 @@ pub enum GenericDef {
|
|||
Enum(Enum),
|
||||
Def(DefId),
|
||||
}
|
||||
|
||||
impl From<Function> for GenericDef {
|
||||
fn from(func: Function) -> GenericDef {
|
||||
GenericDef::Function(func)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Struct> for GenericDef {
|
||||
fn from(s: Struct) -> GenericDef {
|
||||
GenericDef::Struct(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Enum> for GenericDef {
|
||||
fn from(e: Enum) -> GenericDef {
|
||||
GenericDef::Enum(e)
|
||||
}
|
||||
}
|
||||
impl_froms!(GenericDef: Function, Struct, Enum);
|
||||
|
||||
impl From<DefId> for GenericDef {
|
||||
fn from(def_id: DefId) -> GenericDef {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue