Skip to content

Commit cd31cc1

Browse files
committed
perf(formatter/sort_imports): Use Vec::with_capacity for next_elements (#15579)
1 parent 25a0163 commit cd31cc1

File tree

1 file changed

+1
-1
lines changed
  • crates/oxc_formatter/src/ir_transform/sort_imports

1 file changed

+1
-1
lines changed

crates/oxc_formatter/src/ir_transform/sort_imports/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl SortImportsTransform {
136136

137137
// Finally, sort import lines within each chunk.
138138
// After sorting, flatten everything back to `FormatElement`s.
139-
let mut next_elements = vec![];
139+
let mut next_elements = Vec::with_capacity(prev_elements.len());
140140

141141
let mut chunks_iter = chunks.into_iter().enumerate().peekable();
142142
while let Some((idx, chunk)) = chunks_iter.next() {

0 commit comments

Comments
 (0)