From 5d338e901e8106dacf6d45365741938e1cf173a9 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 29 Nov 2024 16:53:55 +0100 Subject: [PATCH] Fix paragraph spacing in Rust 1.82+ --- crates/typst/src/layout/inline/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/typst/src/layout/inline/mod.rs b/crates/typst/src/layout/inline/mod.rs index 4fe831e28..9d4745a19 100644 --- a/crates/typst/src/layout/inline/mod.rs +++ b/crates/typst/src/layout/inline/mod.rs @@ -397,12 +397,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.