mirror of https://github.com/rwf2/Rocket.git
Condense cases in 'def_id_opt'.
This commit is contained in:
parent
35bbb8b60b
commit
c0235d0cde
|
@ -155,25 +155,12 @@ pub trait DefExt {
|
||||||
impl DefExt for Def {
|
impl DefExt for Def {
|
||||||
fn def_id_opt(&self) -> Option<DefId> {
|
fn def_id_opt(&self) -> Option<DefId> {
|
||||||
match *self {
|
match *self {
|
||||||
Def::Fn(id) |
|
Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) | Def::Variant(id)
|
||||||
Def::Mod(id) |
|
| Def::VariantCtor(id, ..) | Def::Enum(id) | Def::TyAlias(id)
|
||||||
Def::Static(id, _) |
|
| Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id)
|
||||||
Def::Variant(id) |
|
| Def::StructCtor(id, ..) | Def::Union(id) | Def::Trait(id)
|
||||||
Def::VariantCtor(id, ..) |
|
| Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id)
|
||||||
Def::Enum(id) |
|
| Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id) => Some(id),
|
||||||
Def::TyAlias(id) |
|
|
||||||
Def::AssociatedTy(id) |
|
|
||||||
Def::TyParam(id) |
|
|
||||||
Def::Struct(id) |
|
|
||||||
Def::StructCtor(id, ..) |
|
|
||||||
Def::Union(id) |
|
|
||||||
Def::Trait(id) |
|
|
||||||
Def::Method(id) |
|
|
||||||
Def::Const(id) |
|
|
||||||
Def::AssociatedConst(id) |
|
|
||||||
Def::Local(id) |
|
|
||||||
Def::Upvar(id, ..) |
|
|
||||||
Def::Macro(id) => Some(id),
|
|
||||||
Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None,
|
Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue