1
1
use clippy_utils:: {
2
2
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,
4
4
source:: { indent_of, snippet} ,
5
5
} ;
6
6
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap } ;
@@ -13,6 +13,7 @@ use rustc_hir::{
13
13
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
14
14
use rustc_middle:: ty:: { subst:: GenericArgKind , Ty , TypeAndMut } ;
15
15
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
16
+ use rustc_span:: sym;
16
17
use rustc_span:: { symbol:: Ident , Span , DUMMY_SP } ;
17
18
use std:: borrow:: Cow ;
18
19
@@ -435,7 +436,7 @@ fn has_drop(expr: &hir::Expr<'_>, first_bind_ident: &Ident, lcx: &LateContext<'_
435
436
if let hir:: ExprKind :: Call ( fun, args) = expr. kind
436
437
&& let hir:: ExprKind :: Path ( hir:: QPath :: Resolved ( _, fun_path) ) = & fun. kind
437
438
&& 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)
439
440
&& let [ first_arg, ..] = args
440
441
&& let hir:: ExprKind :: Path ( hir:: QPath :: Resolved ( _, arg_path) ) = & first_arg. kind
441
442
&& let [ first_arg_ps, .. ] = arg_path. segments
0 commit comments