summaryrefslogtreecommitdiff
path: root/crates/typst-library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-11-29 16:53:55 +0100
committerLaurenz <laurmaedje@gmail.com>2024-11-29 16:56:42 +0100
commit7785e7eb009e76678c7382f9cb44eab94774e32a (patch)
tree31efafb37b30b29758ba3f121365ae52207706c7 /crates/typst-library
parent7bb4f6df44086b4c1120b227f7ae963e6c2ad5ab (diff)
Fix paragraph spacing in Rust 1.82+0.9
Diffstat (limited to 'crates/typst-library')
-rw-r--r--crates/typst-library/src/layout/par.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/typst-library/src/layout/par.rs b/crates/typst-library/src/layout/par.rs
index 10f78ef2..8e43272f 100644
--- a/crates/typst-library/src/layout/par.rs
+++ b/crates/typst-library/src/layout/par.rs
@@ -502,12 +502,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.