Skip to content

Commit 71dfbe2

Browse files
committed
Use Hir::Def opt_def_id
1 parent 35e2e1b commit 71dfbe2

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

clippy_lints/src/utils/mod.rs

+1-34
Original file line numberDiff line numberDiff line change
@@ -987,40 +987,7 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
987987
}
988988

989989
pub fn opt_def_id(def: Def) -> Option<DefId> {
990-
match def {
991-
Def::Fn(id)
992-
| Def::Mod(id)
993-
| Def::Static(id, _)
994-
| Def::Variant(id)
995-
| Def::VariantCtor(id, ..)
996-
| Def::Enum(id)
997-
| Def::TyAlias(id)
998-
| Def::AssociatedTy(id)
999-
| Def::TyParam(id)
1000-
| Def::ConstParam(id)
1001-
| Def::ForeignTy(id)
1002-
| Def::Struct(id)
1003-
| Def::StructCtor(id, ..)
1004-
| Def::Union(id)
1005-
| Def::Trait(id)
1006-
| Def::TraitAlias(id)
1007-
| Def::Method(id)
1008-
| Def::Const(id)
1009-
| Def::AssociatedConst(id)
1010-
| Def::Macro(id, ..)
1011-
| Def::Existential(id)
1012-
| Def::AssociatedExistential(id)
1013-
| Def::SelfCtor(id) => Some(id),
1014-
1015-
Def::Upvar(..)
1016-
| Def::Local(_)
1017-
| Def::Label(..)
1018-
| Def::PrimTy(..)
1019-
| Def::SelfTy(..)
1020-
| Def::ToolMod
1021-
| Def::NonMacroAttr { .. }
1022-
| Def::Err => None,
1023-
}
990+
def.opt_def_id()
1024991
}
1025992

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

0 commit comments

Comments
 (0)