diff --git a/crates/typst/src/layout/inline/mod.rs b/crates/typst/src/layout/inline/mod.rs index 16da1539f..8b2fde2f8 100644 --- a/crates/typst/src/layout/inline/mod.rs +++ b/crates/typst/src/layout/inline/mod.rs @@ -381,12 +381,18 @@ impl<'a> Line<'a> { /// How much can the line stretch fn stretchability(&self) -> Abs { - self.items().filter_map(Item::text).map(|s| s.stretchability()).sum() + self.items() + .filter_map(Item::text) + .map(|s| s.stretchability()) + .fold(Abs::zero(), |acc, x| acc + x) } /// How much can the line shrink fn shrinkability(&self) -> Abs { - self.items().filter_map(Item::text).map(|s| s.shrinkability()).sum() + self.items() + .filter_map(Item::text) + .map(|s| s.shrinkability()) + .fold(Abs::zero(), |acc, x| acc + x) } /// The sum of fractions in the line.