@@ -4,7 +4,7 @@ use clippy_utils::consts::{ConstEvalCtxt, Constant};
44use clippy_utils:: diagnostics:: span_lint_and_then;
55use clippy_utils:: source:: snippet;
66use 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} ;
88use rustc_ast:: ast:: LitKind ;
99use rustc_errors:: Applicability ;
1010use rustc_hir:: def:: Res ;
@@ -14,7 +14,7 @@ use rustc_lint::{LateContext, LateLintPass};
1414use rustc_middle:: ty;
1515use rustc_session:: impl_lint_pass;
1616use rustc_span:: source_map:: Spanned ;
17- use rustc_span:: Span ;
17+ use rustc_span:: { sym , Span } ;
1818use std:: iter;
1919
2020declare_clippy_lint ! {
@@ -76,9 +76,9 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip {
7676 && self . msrv . meets ( msrvs:: STR_STRIP_PREFIX )
7777 && let Some ( method_def_id) = cx. typeck_results ( ) . type_dependent_def_id ( cond. hir_id )
7878 {
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) {
8080 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) {
8282 StripKind :: Suffix
8383 } else {
8484 return ;
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip {
137137fn len_arg < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) -> Option < & ' tcx Expr < ' tcx > > {
138138 if let ExprKind :: MethodCall ( _, arg, [ ] , _) = expr. kind
139139 && 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)
141141 {
142142 Some ( arg)
143143 } else {
0 commit comments