[librsvg: 9/12] Clear new_without_default and match_ref_pats.



commit 6a00a5056017d0c48fe5aaa7f2f6a198dc29f246
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Sun Dec 17 11:35:45 2017 +0200

    Clear new_without_default and match_ref_pats.
    
    For more see:
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#new_without_default
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#match_ref_pats

 rust/src/gradient.rs     |  4 ++--
 rust/src/path_builder.rs | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/rust/src/gradient.rs b/rust/src/gradient.rs
index 4a94582..a6086a1 100644
--- a/rust/src/gradient.rs
+++ b/rust/src/gradient.rs
@@ -210,7 +210,7 @@ impl GradientVariant {
     fn resolve_from_fallback (&mut self, fallback: &GradientVariant) {
         match *self {
             GradientVariant::Linear { ref mut x1, ref mut y1, ref mut x2, ref mut y2 } => {
-                if let &GradientVariant::Linear { x1: x1f, y1: y1f, x2: x2f, y2: y2f } = fallback {
+                if let GradientVariant::Linear { x1: x1f, y1: y1f, x2: x2f, y2: y2f } = *fallback {
                     fallback_to! (*x1, x1f);
                     fallback_to! (*y1, y1f);
                     fallback_to! (*x2, x2f);
@@ -219,7 +219,7 @@ impl GradientVariant {
             },
 
             GradientVariant::Radial { ref mut cx, ref mut cy, ref mut r, ref mut fx, ref mut fy } => {
-                if let &GradientVariant::Radial { cx: cxf, cy: cyf, r: rf, fx: fxf, fy: fyf } = fallback {
+                if let GradientVariant::Radial { cx: cxf, cy: cyf, r: rf, fx: fxf, fy: fyf } = *fallback {
                     fallback_to! (*cx, cxf);
                     fallback_to! (*cy, cyf);
                     fallback_to! (*r,  rf);
diff --git a/rust/src/path_builder.rs b/rust/src/path_builder.rs
index 3911a7d..9e11e2b 100644
--- a/rust/src/path_builder.rs
+++ b/rust/src/path_builder.rs
@@ -25,12 +25,18 @@ pub struct RsvgPathBuilder {
     path_commands: Vec<PathCommand>,
 }
 
-impl RsvgPathBuilder {
-    pub fn new () -> RsvgPathBuilder {
+impl Default for RsvgPathBuilder {
+    fn default() -> RsvgPathBuilder {
         RsvgPathBuilder {
             path_commands: Vec::new ()
         }
     }
+}
+
+impl RsvgPathBuilder {
+    pub fn new () -> RsvgPathBuilder {
+        RsvgPathBuilder::default()
+    }
 
     pub fn move_to (&mut self, x: f64, y: f64) {
         self.path_commands.push (PathCommand::MoveTo (x, y));


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