1
Fork 0

Use extend instead of repeatedly pushing into a vec

This commit is contained in:
Tomasz Miąsko 2022-07-03 00:00:00 +00:00
parent 7e7d007467
commit fadae872fa

View file

@ -352,15 +352,15 @@ fn save_unreachable_coverage(
} }
let start_block = &mut basic_blocks[START_BLOCK]; let start_block = &mut basic_blocks[START_BLOCK];
for (source_info, code_region) in dropped_coverage { start_block.statements.extend(dropped_coverage.into_iter().map(
start_block.statements.push(Statement { |(source_info, code_region)| Statement {
source_info, source_info,
kind: StatementKind::Coverage(Box::new(Coverage { kind: StatementKind::Coverage(Box::new(Coverage {
kind: CoverageKind::Unreachable, kind: CoverageKind::Unreachable,
code_region: Some(code_region), code_region: Some(code_region),
})), })),
}) },
} ));
} }
pub struct SimplifyLocals; pub struct SimplifyLocals;