11use clippy_utils:: {
22 diagnostics:: span_lint_and_then,
3- expr_or_init, get_attr, match_def_path , path_to_local, paths ,
3+ expr_or_init, get_attr, path_to_local,
44 source:: { indent_of, snippet} ,
55} ;
66use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap } ;
@@ -13,6 +13,7 @@ use rustc_hir::{
1313use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
1414use rustc_middle:: ty:: { subst:: GenericArgKind , Ty , TypeAndMut } ;
1515use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
16+ use rustc_span:: sym;
1617use rustc_span:: { symbol:: Ident , Span , DUMMY_SP } ;
1718use std:: borrow:: Cow ;
1819
@@ -435,7 +436,7 @@ fn has_drop(expr: &hir::Expr<'_>, first_bind_ident: &Ident, lcx: &LateContext<'_
435436 if let hir:: ExprKind :: Call ( fun, args) = expr. kind
436437 && let hir:: ExprKind :: Path ( hir:: QPath :: Resolved ( _, fun_path) ) = & fun. kind
437438 && let Res :: Def ( DefKind :: Fn , did) = fun_path. res
438- && match_def_path ( lcx, did, & paths :: DROP )
439+ && lcx. tcx . is_diagnostic_item ( sym :: mem_drop , did)
439440 && let [ first_arg, ..] = args
440441 && let hir:: ExprKind :: Path ( hir:: QPath :: Resolved ( _, arg_path) ) = & first_arg. kind
441442 && let [ first_arg_ps, .. ] = arg_path. segments
0 commit comments