Skip to content

Commit

Permalink
Use Hir::Def opt_def_id
Browse files Browse the repository at this point in the history
  • Loading branch information
h-michael committed Feb 9, 2019
1 parent 35e2e1b commit 71dfbe2
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,40 +987,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
}

pub fn opt_def_id(def: Def) -> Option<DefId> {
match def {
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,
}
def.opt_def_id()
}

pub fn is_self(slf: &Arg) -> bool {
Expand Down

0 comments on commit 71dfbe2

Please sign in to comment.