diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2019-02-09 13:28:21 +0900 |
|---|---|---|
| committer | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2019-02-09 13:28:21 +0900 |
| commit | 71dfbe2072193d2d2db81a54758623b8ba8eaeb7 (patch) | |
| tree | c79d40c3eb8ebfb9c2593b4d4ddc648fca4c9f6c | |
| parent | 35e2e1bb751da8b5daf9a7d9a0c787177aca7625 (diff) | |
| download | rust-71dfbe2072193d2d2db81a54758623b8ba8eaeb7.tar.gz rust-71dfbe2072193d2d2db81a54758623b8ba8eaeb7.zip | |
Use Hir::Def opt_def_id
| -rw-r--r-- | clippy_lints/src/utils/mod.rs | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 40daa2d0b00..a8b6a756b78 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -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 { |
