@@ -4,7 +4,7 @@ use clippy_utils::consts::{ConstEvalCtxt, Constant};
4
4
use clippy_utils:: diagnostics:: span_lint_and_then;
5
5
use clippy_utils:: source:: snippet;
6
6
use clippy_utils:: usage:: mutated_variables;
7
- use clippy_utils:: { eq_expr_value, higher, match_def_path , paths } ;
7
+ use clippy_utils:: { eq_expr_value, higher} ;
8
8
use rustc_ast:: ast:: LitKind ;
9
9
use rustc_errors:: Applicability ;
10
10
use rustc_hir:: def:: Res ;
@@ -14,7 +14,7 @@ use rustc_lint::{LateContext, LateLintPass};
14
14
use rustc_middle:: ty;
15
15
use rustc_session:: impl_lint_pass;
16
16
use rustc_span:: source_map:: Spanned ;
17
- use rustc_span:: Span ;
17
+ use rustc_span:: { sym , Span } ;
18
18
use std:: iter;
19
19
20
20
declare_clippy_lint ! {
@@ -76,9 +76,9 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip {
76
76
&& self . msrv . meets ( msrvs:: STR_STRIP_PREFIX )
77
77
&& let Some ( method_def_id) = cx. typeck_results ( ) . type_dependent_def_id ( cond. hir_id )
78
78
{
79
- let strip_kind = if match_def_path ( cx , method_def_id, & paths :: STR_STARTS_WITH ) {
79
+ let strip_kind = if cx . tcx . is_diagnostic_item ( sym :: str_starts_with , method_def_id) {
80
80
StripKind :: Prefix
81
- } else if match_def_path ( cx , method_def_id, & paths :: STR_ENDS_WITH ) {
81
+ } else if cx . tcx . is_diagnostic_item ( sym :: str_ends_with , method_def_id) {
82
82
StripKind :: Suffix
83
83
} else {
84
84
return ;
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip {
137
137
fn len_arg < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) -> Option < & ' tcx Expr < ' tcx > > {
138
138
if let ExprKind :: MethodCall ( _, arg, [ ] , _) = expr. kind
139
139
&& let Some ( method_def_id) = cx. typeck_results ( ) . type_dependent_def_id ( expr. hir_id )
140
- && match_def_path ( cx , method_def_id, & paths :: STR_LEN )
140
+ && cx . tcx . is_diagnostic_item ( sym :: str_len , method_def_id)
141
141
{
142
142
Some ( arg)
143
143
} else {
0 commit comments