[librsvg: 7/10] Use and_then instead of a match



commit 808743ccd61869f0d60dcd36503eab2fc4118cdc
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu May 2 09:10:13 2019 -0500

    Use and_then instead of a match

 rsvg_internals/src/node.rs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 04c435d6..c1b5b9b1 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -353,10 +353,11 @@ impl Node {
     fn set_transform_attribute(&self, pbag: &PropertyBag<'_>) -> Result<(), NodeError> {
         for (attr, value) in pbag.iter() {
             match attr {
-                Attribute::Transform => match Matrix::parse_str(value).attribute(Attribute::Transform) {
-                    Ok(affine) => self.data.transform.set(affine),
-                    Err(e) => return Err(e),
-                },
+                Attribute::Transform => {
+                    return Matrix::parse_str(value)
+                        .attribute(Attribute::Transform)
+                        .and_then(|affine| Ok(self.data.transform.set(affine)));
+                }
 
                 _ => (),
             }


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