@@ -194,13 +194,11 @@ fn never_loop_expr<'tcx>(
194
194
} ,
195
195
ExprKind :: Match ( e, arms, _) => {
196
196
let e = never_loop_expr ( cx, e, local_labels, main_loop_id) ;
197
- if arms. is_empty ( ) {
198
- e
199
- } else {
200
- combine_seq ( e, || {
201
- never_loop_expr_branch ( cx, & mut arms. iter ( ) . map ( |a| a. body ) , local_labels, main_loop_id)
197
+ combine_seq ( e, || {
198
+ arms. iter ( ) . fold ( NeverLoopResult :: Diverging , |a, b| {
199
+ combine_branches ( a, never_loop_expr ( cx, b. body , local_labels, main_loop_id) )
202
200
} )
203
- }
201
+ } )
204
202
} ,
205
203
ExprKind :: Block ( b, l) => {
206
204
if l. is_some ( ) {
@@ -276,17 +274,6 @@ fn never_loop_expr_all<'tcx, T: Iterator<Item = &'tcx Expr<'tcx>>>(
276
274
combine_seq_many ( es. map ( |e| never_loop_expr ( cx, e, local_labels, main_loop_id) ) )
277
275
}
278
276
279
- fn never_loop_expr_branch < ' tcx , T : Iterator < Item = & ' tcx Expr < ' tcx > > > (
280
- cx : & LateContext < ' tcx > ,
281
- e : & mut T ,
282
- local_labels : & mut Vec < ( HirId , bool ) > ,
283
- main_loop_id : HirId ,
284
- ) -> NeverLoopResult {
285
- e. fold ( NeverLoopResult :: Diverging , |a, b| {
286
- combine_branches ( a, never_loop_expr ( cx, b, local_labels, main_loop_id) )
287
- } )
288
- }
289
-
290
277
fn for_to_if_let_sugg ( cx : & LateContext < ' _ > , iterator : & Expr < ' _ > , pat : & Pat < ' _ > ) -> String {
291
278
let pat_snippet = snippet ( cx, pat. span , "_" ) ;
292
279
let iter_snippet = make_iterator_snippet ( cx, iterator, & mut Applicability :: Unspecified ) ;
0 commit comments