Fix infinite loop in H/VJoins without expanding sections

This commit is contained in:
Joscha 2022-07-23 22:10:08 +02:00
parent f1899ab295
commit 1e4bbc6eab

View file

@ -23,6 +23,11 @@ impl Segment {
}
fn expand(amounts: &mut [(u16, bool)], total: u16) {
let any_expanding = amounts.iter().any(|(_, expanding)| *expanding);
if !any_expanding {
return;
}
// Weirdly, rustc needs this type annotation while rust-analyzer manages to
// derive the correct type in an inlay hint.
let actual: u16 = amounts.iter().map(|(a, _)| *a).sum();