From: Ian Jackson Date: Sat, 22 May 2021 21:16:16 +0000 (+0100) Subject: bundles: Parse size: Small refactoring X-Git-Tag: otter-0.6.0~60 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2c6cbfa7b0e473b1bb71d9dc162456dc39b42084;p=otter.git bundles: Parse size: Small refactoring Signed-off-by: Ian Jackson --- diff --git a/src/bundles.rs b/src/bundles.rs index dd2bd8f0..ceb2929a 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -787,11 +787,12 @@ fn usvg_size(f: &mut BufReader) -> [f64;2] { value.parse().context("parse width/height")? ); - if_chain!{ - if let Some(width) = size[0]; - if let Some(height) = size[1]; - then { break [width,height] } - } + if let Ok(output) = size.iter().cloned() + .filter_map(|s|s) + .collect::>() + .into_inner() { + break output; + } }, XT::ElementEnd {..} => throw!(anyhow!("not found")), _ => { }