@@ -8,7 +8,7 @@ use clippy_utils::{
88use if_chain:: if_chain;
99use rustc_errors:: Applicability ;
1010use rustc_hir:: intravisit:: { walk_expr, Visitor } ;
11- use rustc_hir:: { def:: Res , Expr , ExprKind , HirId , Local , Mutability , PatKind , QPath , UnOp } ;
11+ use rustc_hir:: { Closure , def:: Res , Expr , ExprKind , HirId , Local , Mutability , PatKind , QPath , UnOp } ;
1212use rustc_lint:: LateContext ;
1313use rustc_middle:: ty:: adjustment:: Adjust ;
1414use rustc_span:: { symbol:: sym, Symbol } ;
@@ -220,7 +220,7 @@ fn uses_iter<'tcx>(cx: &LateContext<'tcx>, iter_expr: &IterExpr, container: &'tc
220220 if let Some ( e) = e {
221221 self . visit_expr ( e) ;
222222 }
223- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
223+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
224224 if is_res_used ( self . cx , self . iter_expr . path , id) {
225225 self . uses_iter = true ;
226226 }
@@ -260,7 +260,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
260260 if let Some ( e) = e {
261261 self . visit_expr ( e) ;
262262 }
263- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
263+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
264264 self . used_iter = is_res_used ( self . cx , self . iter_expr . path , id) ;
265265 } else {
266266 walk_expr ( self , e) ;
@@ -307,7 +307,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
307307 if let Some ( e) = e {
308308 self . visit_expr ( e) ;
309309 }
310- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
310+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
311311 self . used_after = is_res_used ( self . cx , self . iter_expr . path , id) ;
312312 } else {
313313 walk_expr ( self , e) ;
0 commit comments