Skip to content

Commit fadae87

Browse files
committed
Use extend instead of repeatedly pushing into a vec
1 parent 7e7d007 commit fadae87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_mir_transform/src/simplify.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,15 @@ fn save_unreachable_coverage(
352352
}
353353

354354
let start_block = &mut basic_blocks[START_BLOCK];
355-
for (source_info, code_region) in dropped_coverage {
356-
start_block.statements.push(Statement {
355+
start_block.statements.extend(dropped_coverage.into_iter().map(
356+
|(source_info, code_region)| Statement {
357357
source_info,
358358
kind: StatementKind::Coverage(Box::new(Coverage {
359359
kind: CoverageKind::Unreachable,
360360
code_region: Some(code_region),
361361
})),
362-
})
363-
}
362+
},
363+
));
364364
}
365365

366366
pub struct SimplifyLocals;

0 commit comments

Comments
 (0)