From b13ed627fff73a599b34d760cd99aa2f08d58ea8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 30 Nov 2019 14:10:35 +0100 Subject: =?UTF-8?q?Better=20error=20reporting=20=F0=9F=9A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/flex.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/layout/flex.rs') diff --git a/src/layout/flex.rs b/src/layout/flex.rs index 053954a4..53f6dfdf 100644 --- a/src/layout/flex.rs +++ b/src/layout/flex.rs @@ -126,20 +126,8 @@ impl FlexLayouter { } } - pub fn remaining(&self) -> LayoutResult<(LayoutSpaces, Option)> { - if self.run_is_empty() { - Ok((self.stack.remaining(), None)) - } else { - let mut future = self.clone(); - let remaining_run = future.finish_run()?; - - let stack_spaces = future.stack.remaining(); - let mut flex_spaces = stack_spaces.clone(); - flex_spaces[0].dimensions.x = remaining_run.x; - flex_spaces[0].dimensions.y += remaining_run.y; - - Ok((flex_spaces, Some(stack_spaces))) - } + pub fn remaining(&self) -> LayoutSpaces { + self.stack.remaining() } pub fn run_is_empty(&self) -> bool { @@ -242,7 +230,7 @@ impl FlexLayouter { while size.x > self.line.usable { if self.stack.space_is_last() { - Err(LayoutError::NotEnoughSpace("failed to add box to flex run"))?; + lerr!("box does not fit into line"); } self.stack.finish_space(true); -- cgit v1.2.3