[librsvg/rustification] marker.rs: Create segments without an auxiliary variable



commit 20fae805ca92e65ed5324a3989f3bd7d0313bd8f
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 26 21:01:40 2016 -0500

    marker.rs: Create segments without an auxiliary variable

 rust/src/marker.rs |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 862d6cf..2703071 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -101,8 +101,6 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
         last_x = cur_x;
         last_y = cur_y;
 
-        let seg: Segment;
-
         match cairo_segment {
             cairo::PathSegment::MoveTo ((x, y)) => {
                 cur_x = x;
@@ -148,30 +146,27 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
                 cur_x = x;
                 cur_y = y;
 
-                seg = make_line (last_x, last_y, cur_x, cur_y);
+                segments.push (make_line (last_x, last_y, cur_x, cur_y));
 
                 state = SegmentState::InSubpath;
-                segments.push (seg);
             },
 
             cairo::PathSegment::CurveTo ((x2, y2), (x3, y3), (x4, y4)) => {
                 cur_x = x4;
                 cur_y = y4;
 
-                seg = make_curve (last_x, last_y, x2, y2, x3, y3, cur_x, cur_y);
+                segments.push (make_curve (last_x, last_y, x2, y2, x3, y3, cur_x, cur_y));
 
                 state = SegmentState::InSubpath;
-                segments.push (seg);
             },
 
             cairo::PathSegment::ClosePath => {
                 cur_x = subpath_start_x;
                 cur_y = subpath_start_y;
 
-                seg = make_line (last_x, last_y, cur_x, cur_y);
+                segments.push (make_line (last_x, last_y, cur_x, cur_y));
 
                 state = SegmentState::ClosedSubpath;
-                segments.push (seg);
             }
         }
     }
@@ -181,8 +176,7 @@ pub fn path_to_segments (path: cairo::Path) -> Vec<Segment> {
             /* Output a lone point if we started a subpath with a
              * moveto command, but there are no subsequent commands.
              */
-            let seg = make_degenerate (cur_x, cur_y);
-            segments.push (seg);
+            segments.push (make_degenerate (cur_x, cur_y));
         },
 
         _ => {


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