[librsvg] Replace if Some(...) for and_then()



commit b22acbf94b14f58182b5c28a7b2904edede32806
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 20 12:57:59 2019 -0600

    Replace if Some(...) for and_then()

 rsvg_internals/src/drawing_ctx.rs | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index c159bc48..ee907d03 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -239,7 +239,7 @@ impl DrawingCtx {
             }
         }
 
-        if let Some(matrix) = preserve_aspect_ratio.viewport_to_viewbox_transform(vbox, viewport) {
+        preserve_aspect_ratio.viewport_to_viewbox_transform(vbox, viewport).and_then(|matrix| {
             let params = if let Some(ref vbox) = vbox {
                 self.push_view_box(vbox.width, vbox.height)
             } else {
@@ -257,11 +257,7 @@ impl DrawingCtx {
             }
 
             Some(params)
-        } else {
-            // Width or height of 0 for the viewBox disables rendering of the element
-            // https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
-            None
-        }
+        })
     }
 
     pub fn insert_bbox(&mut self, bbox: &BoundingBox) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]