@@ -1219,18 +1219,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1219
1219
debug ! ( "match_candidates: {:?} candidates fully matched" , fully_matched) ;
1220
1220
let ( matched_candidates, unmatched_candidates) = candidates. split_at_mut ( fully_matched) ;
1221
1221
1222
- let block = if !matched_candidates. is_empty ( ) {
1223
- let otherwise_block =
1224
- self . select_matched_candidates ( matched_candidates, start_block, fake_borrows) ;
1225
-
1226
- if let Some ( last_otherwise_block) = otherwise_block {
1227
- last_otherwise_block
1228
- } else {
1229
- self . cfg . start_new_block ( )
1230
- }
1231
- } else {
1232
- start_block
1233
- } ;
1222
+ let block = self . select_matched_candidates ( matched_candidates, start_block, fake_borrows) ;
1234
1223
1235
1224
// If there are no candidates that still need testing, we're
1236
1225
// done. Since all matches are exhaustive, execution should
@@ -1282,11 +1271,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1282
1271
matched_candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
1283
1272
start_block : BasicBlock ,
1284
1273
fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1285
- ) -> Option < BasicBlock > {
1286
- debug_assert ! (
1287
- !matched_candidates. is_empty( ) ,
1288
- "select_matched_candidates called with no candidates" ,
1289
- ) ;
1274
+ ) -> BasicBlock {
1275
+ if matched_candidates. is_empty ( ) {
1276
+ return start_block;
1277
+ }
1290
1278
debug_assert ! (
1291
1279
matched_candidates. iter( ) . all( |c| c. subcandidates. is_empty( ) ) ,
1292
1280
"subcandidates should be empty in select_matched_candidates" ,
@@ -1356,7 +1344,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1356
1344
candidate. pre_binding_block = Some ( self . cfg . start_new_block ( ) ) ;
1357
1345
}
1358
1346
1359
- reachable_candidates. last_mut ( ) . unwrap ( ) . otherwise_block
1347
+ reachable_candidates
1348
+ . last_mut ( )
1349
+ . unwrap ( )
1350
+ . otherwise_block
1351
+ . unwrap_or_else ( || self . cfg . start_new_block ( ) )
1360
1352
}
1361
1353
1362
1354
/// Tests a candidate where there are only or-patterns left to test, or
0 commit comments