]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/manual_strip.rs
Rollup merge of #91562 - dtolnay:asyncspace, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / clippy_lints / src / manual_strip.rs
index db12c377488b0585cdcd375bf035cf38fb859f99..f8e28f1671f07cc66b26a6f0dd74570d38595d95 100644 (file)
@@ -42,6 +42,7 @@
     ///     assert_eq!(end.to_uppercase(), "WORLD!");
     /// }
     /// ```
+    #[clippy::version = "1.48.0"]
     pub MANUAL_STRIP,
     complexity,
     "suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing"
@@ -73,7 +74,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         }
 
         if_chain! {
-            if let ExprKind::If(cond, then, _) = &expr.kind;
+            if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr);
             if let ExprKind::MethodCall(_, _, [target_arg, pattern], _) = cond.kind;
             if let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(cond.hir_id);
             if let ExprKind::Path(target_path) = &target_arg.kind;
@@ -212,7 +213,7 @@ fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
                 if is_ref_str(self.cx, ex);
                 let unref = peel_ref(ex);
                 if let ExprKind::Index(indexed, index) = &unref.kind;
-                if let Some(higher::Range { start, end, .. }) = higher::range(index);
+                if let Some(higher::Range { start, end, .. }) = higher::Range::hir(index);
                 if let ExprKind::Path(path) = &indexed.kind;
                 if self.cx.qpath_res(path, ex.hir_id) == self.target;
                 then {