diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs
index 6a2669a63..308002a1f 100644
--- a/src/compute/flexbox.rs
+++ b/src/compute/flexbox.rs
@@ -735,13 +735,17 @@ fn collect_flex_lines<'a>(
flex_items: &'a mut Vec<FlexItem>,
) -> Vec<FlexLine<'a>> {
if tree.style(node).flex_wrap == FlexWrap::NoWrap {
- vec![FlexLine { items: flex_items.as_mut_slice(), cross_size: 0.0, offset_cross: 0.0 }]
+ let mut lines = Vec::with_capacity(1);
+ lines.push(FlexLine { items: flex_items.as_mut_slice(), cross_size: 0.0, offset_cross: 0.0 });
+ lines
} else {
match available_space.main(constants.dir) {
// If we're sizing under a max-content constraint then the flex items will never wrap
// (at least for now - future extensions to the CSS spec may add provisions for forced wrap points)
AvailableSpace::MaxContent => {
- vec![FlexLine { items: flex_items.as_mut_slice(), cross_size: 0.0, offset_cross: 0.0 }]
+ let mut lines = Vec::with_capacity(1);
+ lines.push(FlexLine { items: flex_items.as_mut_slice(), cross_size: 0.0, offset_cross: 0.0 });
+ lines
}
// If flex-wrap is Wrap and we're sizing under a min-content constraint, then we take every possible wrapping opportunity
// and place each item in it's own line