@@ -197,20 +197,21 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
197
197
} ;
198
198
let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
199
199
euv:: ExprUseVisitor :: new ( & mut ctx, & infcx, fn_def_id, cx. param_env , cx. typeck_results ( ) ) . consume_body ( body) ;
200
- if is_async {
201
- let mut checked_closures = FxHashSet :: default ( ) ;
202
-
203
- // We retrieve all the closures declared in the async function because they will
204
- // not be found by `euv::Delegate`.
205
- let mut closures: FxHashSet < LocalDefId > = FxHashSet :: default ( ) ;
206
- for_each_expr_with_closures ( cx, body, |expr| {
207
- if let ExprKind :: Closure ( closure) = expr. kind {
208
- closures. insert ( closure. def_id ) ;
209
- }
210
- ControlFlow :: < ( ) > :: Continue ( ( ) )
211
- } ) ;
212
- check_closures ( & mut ctx, cx, & infcx, & mut checked_closures, closures) ;
213
200
201
+ let mut checked_closures = FxHashSet :: default ( ) ;
202
+
203
+ // We retrieve all the closures declared in the function because they will not be found
204
+ // by `euv::Delegate`.
205
+ let mut closures: FxHashSet < LocalDefId > = FxHashSet :: default ( ) ;
206
+ for_each_expr_with_closures ( cx, body, |expr| {
207
+ if let ExprKind :: Closure ( closure) = expr. kind {
208
+ closures. insert ( closure. def_id ) ;
209
+ }
210
+ ControlFlow :: < ( ) > :: Continue ( ( ) )
211
+ } ) ;
212
+ check_closures ( & mut ctx, cx, & infcx, & mut checked_closures, closures) ;
213
+
214
+ if is_async {
214
215
while !ctx. async_closures . is_empty ( ) {
215
216
let async_closures = ctx. async_closures . clone ( ) ;
216
217
ctx. async_closures . clear ( ) ;
0 commit comments