Skip to content

Commit e0296a0

Browse files
committed
Don't create unnecessary block
1 parent 4754f10 commit e0296a0

File tree

1 file changed

+3
-10
lines changed
  • src/librustc_mir/build/matches

1 file changed

+3
-10
lines changed

src/librustc_mir/build/matches/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,13 +1270,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
12701270

12711271
let mut block = candidate.pre_binding_block.unwrap();
12721272

1273-
// If we are adding our own statements, then we need a fresh block.
1274-
let create_fresh_block = candidate.next_candidate_pre_binding_block.is_some()
1275-
|| !candidate.bindings.is_empty()
1276-
|| !candidate.ascriptions.is_empty()
1277-
|| guard.is_some();
1278-
1279-
if create_fresh_block {
1273+
if candidate.next_candidate_pre_binding_block.is_some() {
12801274
let fresh_block = self.cfg.start_new_block();
12811275
self.false_edges(
12821276
block,
@@ -1285,11 +1279,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
12851279
candidate_source_info,
12861280
);
12871281
block = fresh_block;
1288-
self.ascribe_types(block, &candidate.ascriptions);
1289-
} else {
1290-
return block;
12911282
}
12921283

1284+
self.ascribe_types(block, &candidate.ascriptions);
1285+
12931286
// rust-lang/rust#27282: The `autoref` business deserves some
12941287
// explanation here.
12951288
//

0 commit comments

Comments
 (0)