[librsvg: 3/4] As PackedCommand is a single byte large, make it copy and pass it by value as Clippy suggests.



commit 6ac906e7cac32901c384c50593db86b172cf53c1
Author: Adam Reichold <adam reichold t-online de>
Date:   Sun Apr 5 23:19:51 2020 +0200

    As PackedCommand is a single byte large, make it copy and pass it by value as Clippy suggests.

 rsvg_internals/src/path_builder.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index 3c9ced67..c67c1903 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -386,8 +386,8 @@ impl PathCommand {
         }
     }
 
-    fn from_packed<'a>(packed: &PackedCommand, coords: &mut slice::Iter<'a, f64>) -> PathCommand {
-        match *packed {
+    fn from_packed<'a>(packed: PackedCommand, coords: &mut slice::Iter<'a, f64>) -> PathCommand {
+        match packed {
             PackedCommand::MoveTo => {
                 let x = take_one(coords);
                 let y = take_one(coords);
@@ -460,7 +460,7 @@ pub struct Path {
 
 /// Packed version of a `PathCommand`, used in `Path`.
 #[repr(u8)]
-#[derive(Debug)]
+#[derive(Debug, Clone, Copy)]
 enum PackedCommand {
     MoveTo,
     LineTo,
@@ -549,7 +549,7 @@ impl Path {
         let commands = self.commands.iter();
         let mut coords = self.coords.iter();
 
-        commands.map(move |cmd| PathCommand::from_packed(cmd, &mut coords))
+        commands.map(move |cmd| PathCommand::from_packed(*cmd, &mut coords))
     }
 
     pub fn is_empty(&self) -> bool {


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