Skip to content

Commit 7d64eb9

Browse files
committed
perf(codegen): replace loop + push with std::iter::repeat (#12398)
1 parent 8917a5f commit 7d64eb9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

crates/oxc_codegen/src/sourcemap_builder.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,7 @@ impl<'a> SourcemapBuilder<'a> {
360360
for (chunk_byte_offset, ch) in remaining.char_indices() {
361361
#[expect(clippy::cast_possible_truncation)]
362362
let mut chunk_byte_offset = chunk_byte_offset as u32;
363-
for _ in 0..ch.len_utf8() {
364-
columns.push(column);
365-
}
363+
columns.extend(std::iter::repeat_n(column, ch.len_utf8()));
366364

367365
match ch {
368366
'\r' => {

0 commit comments

Comments
 (0)