]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/only_used_in_recursion.rs
Better handle method/function calls
[rust.git] / clippy_lints / src / only_used_in_recursion.rs
index de5f77f3ad976c025f8bdcf1ec2f1e25842ac71a..413a740be25a529c0fe8fb64361dd38d567de634 100644 (file)
@@ -11,8 +11,8 @@
 use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
 use rustc_hir::intravisit::{walk_expr, walk_stmt, FnKind, Visitor};
 use rustc_hir::{
-    Arm, Block, Body, Expr, ExprKind, Guard, HirId, ImplicitSelfKind, Let, Local, Pat, PatKind, Path, PathSegment,
-    QPath, Stmt, StmtKind, TyKind, UnOp,
+    Arm, Block, Body, Closure, Expr, ExprKind, Guard, HirId, ImplicitSelfKind, Let, Local, Pat, PatKind, Path,
+    PathSegment, QPath, Stmt, StmtKind, TyKind, UnOp,
 };
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_middle::ty;
@@ -87,7 +87,7 @@
     /// #     print!("{}", f(1));
     /// # }
     /// ```
-    #[clippy::version = "1.60.0"]
+    #[clippy::version = "1.61.0"]
     pub ONLY_USED_IN_RECURSION,
     nursery,
     "arguments that is only used in recursion can be removed"
@@ -298,7 +298,7 @@ fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
             },
             ExprKind::Match(expr, arms, _) => self.visit_match(expr, arms),
             // since analysing the closure is not easy, just set all variables in it to side-effect
-            ExprKind::Closure { body, .. } => {
+            ExprKind::Closure(&Closure { body, .. }) => {
                 let body = self.tcx.hir().body(body);
                 self.visit_body(body);
                 let vars = std::mem::take(&mut self.ret_vars);