@@ -194,13 +194,11 @@ fn never_loop_expr<'tcx>(
194194 } ,
195195 ExprKind :: Match ( e, arms, _) => {
196196 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) )
202200 } )
203- }
201+ } )
204202 } ,
205203 ExprKind :: Block ( b, l) => {
206204 if l. is_some ( ) {
@@ -276,17 +274,6 @@ fn never_loop_expr_all<'tcx, T: Iterator<Item = &'tcx Expr<'tcx>>>(
276274 combine_seq_many ( es. map ( |e| never_loop_expr ( cx, e, local_labels, main_loop_id) ) )
277275}
278276
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-
290277fn for_to_if_let_sugg ( cx : & LateContext < ' _ > , iterator : & Expr < ' _ > , pat : & Pat < ' _ > ) -> String {
291278 let pat_snippet = snippet ( cx, pat. span , "_" ) ;
292279 let iter_snippet = make_iterator_snippet ( cx, iterator, & mut Applicability :: Unspecified ) ;
0 commit comments