@@ -8,7 +8,7 @@ use clippy_utils::{
8
8
use if_chain:: if_chain;
9
9
use rustc_errors:: Applicability ;
10
10
use 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 } ;
12
12
use rustc_lint:: LateContext ;
13
13
use rustc_middle:: ty:: adjustment:: Adjust ;
14
14
use rustc_span:: { symbol:: sym, Symbol } ;
@@ -220,7 +220,7 @@ fn uses_iter<'tcx>(cx: &LateContext<'tcx>, iter_expr: &IterExpr, container: &'tc
220
220
if let Some ( e) = e {
221
221
self . visit_expr ( e) ;
222
222
}
223
- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
223
+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
224
224
if is_res_used ( self . cx , self . iter_expr . path , id) {
225
225
self . uses_iter = true ;
226
226
}
@@ -260,7 +260,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
260
260
if let Some ( e) = e {
261
261
self . visit_expr ( e) ;
262
262
}
263
- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
263
+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
264
264
self . used_iter = is_res_used ( self . cx , self . iter_expr . path , id) ;
265
265
} else {
266
266
walk_expr ( self , e) ;
@@ -307,7 +307,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: &
307
307
if let Some ( e) = e {
308
308
self . visit_expr ( e) ;
309
309
}
310
- } else if let ExprKind :: Closure { body : id, .. } = e. kind {
310
+ } else if let ExprKind :: Closure ( & Closure { body : id, .. } ) = e. kind {
311
311
self . used_after = is_res_used ( self . cx , self . iter_expr . path , id) ;
312
312
} else {
313
313
walk_expr ( self , e) ;
0 commit comments