From 2c6cbfa7b0e473b1bb71d9dc162456dc39b42084 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 22 May 2021 22:16:16 +0100 Subject: [PATCH] bundles: Parse size: Small refactoring Signed-off-by: Ian Jackson --- src/bundles.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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")), _ => { } -- 2.30.2