]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/vec.rs
Rollup merge of #88215 - jyn514:lazy-loading, r=petrochenkov
[rust.git] / src / tools / clippy / clippy_lints / src / vec.rs
index 32fa46f042ce1d403f8d9f6e69a834afcf0b11aa..95a45fa937f11ab8d9a7f79fa4eae96016bad9d8 100644 (file)
@@ -49,8 +49,8 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if_chain! {
             if let ty::Ref(_, ty, _) = cx.typeck_results().expr_ty_adjusted(expr).kind();
             if let ty::Slice(..) = ty.kind();
-            if let ExprKind::AddrOf(BorrowKind::Ref, mutability, addressee) = expr.kind;
-            if let Some(vec_args) = higher::vec_macro(cx, addressee);
+            if let ExprKind::AddrOf(BorrowKind::Ref, mutability, ref addressee) = expr.kind;
+            if let Some(vec_args) = higher::VecArgs::hir(cx, addressee);
             then {
                 self.check_vec_macro(cx, &vec_args, mutability, expr.span);
             }
@@ -58,8 +58,8 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
 
         // search for `for _ in vec![…]`
         if_chain! {
-            if let Some((_, arg, _, _)) = higher::for_loop(expr);
-            if let Some(vec_args) = higher::vec_macro(cx, arg);
+            if let Some(higher::ForLoop { arg, .. }) = higher::ForLoop::hir(expr);
+            if let Some(vec_args) = higher::VecArgs::hir(cx, arg);
             if is_copy(cx, vec_type(cx.typeck_results().expr_ty_adjusted(arg)));
             then {
                 // report the error around the `vec!` not inside `<std macros>:`