Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7be018c

Browse files
committedJan 26, 2025·
refactor(mangler): simplify initialization of slots
1 parent e472ced commit 7be018c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎crates/oxc_mangler/src/lib.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,8 @@ impl Mangler {
179179
let allocator = Allocator::default();
180180

181181
// All symbols with their assigned slots. Keyed by symbol id.
182-
let mut slots: Vec<'_, Slot> = Vec::with_capacity_in(symbol_table.len(), &allocator);
183-
for _ in 0..symbol_table.len() {
184-
slots.push(0);
185-
}
182+
let mut slots: Vec<'_, Slot> =
183+
Vec::from_iter_in(iter::repeat_n(0, symbol_table.len()), &allocator);
186184

187185
// Stores the lived scope ids for each slot. Keyed by slot number.
188186
let mut slot_liveness: std::vec::Vec<FixedBitSet> = vec![];

0 commit comments

Comments
 (0)
Please sign in to comment.