Use Hir::Def opt_def_id
This commit is contained in:
parent
35e2e1bb75
commit
71dfbe2072
@ -987,40 +987,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn opt_def_id(def: Def) -> Option<DefId> {
|
pub fn opt_def_id(def: Def) -> Option<DefId> {
|
||||||
match def {
|
def.opt_def_id()
|
||||||
Def::Fn(id)
|
|
||||||
| Def::Mod(id)
|
|
||||||
| Def::Static(id, _)
|
|
||||||
| Def::Variant(id)
|
|
||||||
| Def::VariantCtor(id, ..)
|
|
||||||
| Def::Enum(id)
|
|
||||||
| Def::TyAlias(id)
|
|
||||||
| Def::AssociatedTy(id)
|
|
||||||
| Def::TyParam(id)
|
|
||||||
| Def::ConstParam(id)
|
|
||||||
| Def::ForeignTy(id)
|
|
||||||
| Def::Struct(id)
|
|
||||||
| Def::StructCtor(id, ..)
|
|
||||||
| Def::Union(id)
|
|
||||||
| Def::Trait(id)
|
|
||||||
| Def::TraitAlias(id)
|
|
||||||
| Def::Method(id)
|
|
||||||
| Def::Const(id)
|
|
||||||
| Def::AssociatedConst(id)
|
|
||||||
| Def::Macro(id, ..)
|
|
||||||
| Def::Existential(id)
|
|
||||||
| Def::AssociatedExistential(id)
|
|
||||||
| Def::SelfCtor(id) => Some(id),
|
|
||||||
|
|
||||||
Def::Upvar(..)
|
|
||||||
| Def::Local(_)
|
|
||||||
| Def::Label(..)
|
|
||||||
| Def::PrimTy(..)
|
|
||||||
| Def::SelfTy(..)
|
|
||||||
| Def::ToolMod
|
|
||||||
| Def::NonMacroAttr { .. }
|
|
||||||
| Def::Err => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_self(slf: &Arg) -> bool {
|
pub fn is_self(slf: &Arg) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user