[librsvg: 11/21] Fix clippy borrow errors Most are references that are borrowed then immediately dereferenced There's




commit bdcafbe246cd4cc7aa9d74fb92ed843b2186a346
Author: Madds H <madds hollandart io>
Date:   Mon Aug 23 09:51:49 2021 -0500

    Fix clippy borrow errors
    Most are references that are borrowed then immediately dereferenced
    There's also a couple of unwraps that had function calls inside them
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/576>

 src/transform.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/transform.rs b/src/transform.rs
index cae7e5cf..6780e53c 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -180,7 +180,7 @@ fn parse_prop_translate_args<'i>(
                 p.expect_comma()?;
                 Length::parse(p)
             })
-            .unwrap_or(Length::<Vertical>::new(0.0, LengthUnit::Px));
+            .unwrap_or_else(|_| Length::<Vertical>::new(0.0, LengthUnit::Px));
 
         Ok(TransformFunction::Translate(tx, ty))
     })
@@ -258,7 +258,7 @@ fn parse_prop_skew_args<'i>(
         p.expect_comma()?;
         let ay = p
             .try_parse(|p| Angle::parse(p))
-            .unwrap_or(Angle::from_degrees(0.0));
+            .unwrap_or_else(|_| Angle::from_degrees(0.0));
 
         Ok(TransformFunction::Skew(ax, ay))
     })


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