Skip to content

Commit beacaba

Browse files
avm2: Collect into ArrayStorage instead of iteration
1 parent a00a5ed commit beacaba

File tree

1 file changed

+5
-4
lines changed
  • core/src/avm2/globals/flash/text

1 file changed

+5
-4
lines changed

core/src/avm2/globals/flash/text/font.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ pub fn enumerate_fonts<'gc>(
133133
});
134134

135135
let font_class = activation.avm2().classes().font;
136-
let mut storage = ArrayStorage::new(fonts.len());
137-
for font in fonts {
138-
storage.push(FontObject::for_font(activation.gc(), font_class, font).into());
139-
}
136+
let mut storage = fonts
137+
.into_iter()
138+
.map(|font| FontObject::for_font(activation.gc(), font_class, font))
139+
.collect();
140+
140141
Ok(ArrayObject::from_storage(activation, storage).into())
141142
}
142143

0 commit comments

Comments
 (0)