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 { - 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 {