[librsvg/rustification] marker.rs: Remove auxiliary variables



commit 456d3ed5f2dc85496a38f99a3aed3e63ae615d36
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Oct 28 21:30:08 2016 -0500

    marker.rs: Remove auxiliary variables

 rust/src/marker.rs |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index dcee96a..8db0ac6 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -234,40 +234,25 @@ fn is_zero_length_segment (segment: &Segment) -> bool {
  */
 fn find_incoming_directionality_backwards (segments: Vec<Segment>, start_index: usize) -> (bool, f64, f64)
 {
-    let mut found: bool;
-    let mut vx: f64;
-    let mut vy: f64;
-
     /* "go backwards ... within the current subpath until ... segment which has directionality at its end 
point" */
 
-    found = false;
-    vx = 0.0;
-    vy = 0.0;
-
     for j in (0 .. start_index + 1).rev () {
         match segments[j] {
             Segment::Degenerate { .. } => {
-                break; /* reached the beginning of the subpath as we ran into a standalone point */
+                return (false, 0.0, 0.0); /* reached the beginning of the subpath as we ran into a 
standalone point */
             },
 
             Segment::LineOrCurve { x3, y3, x4, y4, .. } => {
                 if is_zero_length_segment (&segments[j]) {
                     continue;
                 } else {
-                    vx = x4 - x3;
-                    vy = y4 - y3;
-                    found = true;
-                    break;
+                    return (true, x4 - x3, y4 - y3);
                 }
             }
         }
     }
 
-    if found {
-        (true, vx, vy)
-    } else {
-        (false, 0.0, 0.0)
-    }
+    (false, 0.0, 0.0)
 }
 
 


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