@@ -68,18 +68,6 @@ fn combine_seq(first: NeverLoopResult, second: NeverLoopResult) -> NeverLoopResu
6868 }
6969}
7070
71- // Combine two results where both parts are called but not necessarily in order.
72- #[ must_use]
73- fn combine_both ( left : NeverLoopResult , right : NeverLoopResult ) -> NeverLoopResult {
74- match ( left, right) {
75- ( NeverLoopResult :: MayContinueMainLoop , _) | ( _, NeverLoopResult :: MayContinueMainLoop ) => {
76- NeverLoopResult :: MayContinueMainLoop
77- } ,
78- ( NeverLoopResult :: AlwaysBreak , _) | ( _, NeverLoopResult :: AlwaysBreak ) => NeverLoopResult :: AlwaysBreak ,
79- ( NeverLoopResult :: Otherwise , NeverLoopResult :: Otherwise ) => NeverLoopResult :: Otherwise ,
80- }
81- }
82-
8371// Combine two results where only one of the part may have been executed.
8472#[ must_use]
8573fn combine_branches ( b1 : NeverLoopResult , b2 : NeverLoopResult ) -> NeverLoopResult {
@@ -139,7 +127,7 @@ fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: H
139127 ExprKind :: Struct ( _, fields, base) => {
140128 let fields = never_loop_expr_all ( & mut fields. iter ( ) . map ( |f| f. expr ) , ignore_ids, main_loop_id) ;
141129 if let Some ( base) = base {
142- combine_both ( fields, never_loop_expr ( base, ignore_ids, main_loop_id) )
130+ combine_seq ( fields, never_loop_expr ( base, ignore_ids, main_loop_id) )
143131 } else {
144132 fields
145133 }
@@ -218,7 +206,7 @@ fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: H
218206 | InlineAsmOperand :: SymFn { .. }
219207 | InlineAsmOperand :: SymStatic { .. } => NeverLoopResult :: Otherwise ,
220208 } )
221- . fold ( NeverLoopResult :: Otherwise , combine_both ) ,
209+ . fold ( NeverLoopResult :: Otherwise , combine_seq ) ,
222210 ExprKind :: Yield ( _, _)
223211 | ExprKind :: Closure { .. }
224212 | ExprKind :: Path ( _)
@@ -234,7 +222,7 @@ fn never_loop_expr_all<'a, T: Iterator<Item = &'a Expr<'a>>>(
234222 main_loop_id : HirId ,
235223) -> NeverLoopResult {
236224 es. map ( |e| never_loop_expr ( e, ignore_ids, main_loop_id) )
237- . fold ( NeverLoopResult :: Otherwise , combine_both )
225+ . fold ( NeverLoopResult :: Otherwise , combine_seq )
238226}
239227
240228fn never_loop_expr_branch < ' a , T : Iterator < Item = & ' a Expr < ' a > > > (
0 commit comments