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:57:18 +0100
commitc51612f7b20eae7e63b2a34ca69d0114e44a8757 (patch)
tree3b61b27ec35e41fb8cc48a18d5e6ca051750e6a9 /crates/typst-library
parent360cc9b9570f263d52530b98d0c93523e7bdb100 (diff)
Fix paragraph spacing in Rust 1.82+0.8
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 e28e661c..09760440 100644
--- a/crates/typst-library/src/layout/par.rs
+++ b/crates/typst-library/src/layout/par.rs
@@ -507,12 +507,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.