[librsvg: 8/12] Clear warnings.



commit da8793500de203759e3f29b0eca4c31ede8cd635
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Sun Dec 17 11:12:10 2017 +0200

    Clear warnings.
    
    Clear redundant_closue, if_let_redundant_pattern_matching,
    while_let_on_iterator and assign_op_pattern.
    
    For more see:
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#redundant_closure
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#if_let_redundant_pattern_matching
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#while_let_on_iterator
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#assign_op_pattern

 rust/src/aspect_ratio.rs | 4 ++--
 rust/src/drawing_ctx.rs  | 4 ++--
 rust/src/marker.rs       | 4 ++--
 rust/src/path_parser.rs  | 2 +-
 rust/src/property_bag.rs | 2 +-
 rust/src/shapes.rs       | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/rust/src/aspect_ratio.rs b/rust/src/aspect_ratio.rs
index 5039b67..4be5540 100644
--- a/rust/src/aspect_ratio.rs
+++ b/rust/src/aspect_ratio.rs
@@ -176,9 +176,9 @@ impl Parse for AspectRatio {
         let mut fit_mode = FitMode::Meet;
 
         let mut state = ParseState::Defer;
-        let mut iter = s.split_whitespace ();
 
-        while let Some (v) = iter.next () {
+        for v in s.split_whitespace () {
+    
             match state {
                 ParseState::Defer => {
                     if v == "defer" {
diff --git a/rust/src/drawing_ctx.rs b/rust/src/drawing_ctx.rs
index f6889e0..93ae444 100644
--- a/rust/src/drawing_ctx.rs
+++ b/rust/src/drawing_ctx.rs
@@ -277,7 +277,7 @@ pub fn state_get_stop_color (state: *const RsvgState) -> Result<Option<Color>, A
         if spec_ptr.is_null () {
             Ok (None)
         } else {
-            Color::from_color_spec (&*spec_ptr).map (|color| Some (color))
+            Color::from_color_spec (&*spec_ptr).map (Some)
         }
     }
 }
@@ -289,7 +289,7 @@ pub fn state_get_stop_opacity (state: *const RsvgState) -> Result<Option<Opacity
         if opacity_ptr.is_null () {
             Ok (None)
         } else {
-            Opacity::from_opacity_spec (&*opacity_ptr).map (|opacity| Some (opacity))
+            Opacity::from_opacity_spec (&*opacity_ptr).map (Some)
         }
     }
 }
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 1087775..3672f4f 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -71,8 +71,8 @@ impl Parse for MarkerOrient {
         match s {
             "auto" => Ok (MarkerOrient::Auto),
             _      => parsers::angle_degrees (s)
-                .map (|degrees| MarkerOrient::Degrees (degrees) )
-                .map_err (|e| AttributeError::Parse (e))
+                .map (MarkerOrient::Degrees)
+                .map_err (AttributeError::Parse)
         }
     }
 }
diff --git a/rust/src/path_parser.rs b/rust/src/path_parser.rs
index 24b975d..857e3a2 100644
--- a/rust/src/path_parser.rs
+++ b/rust/src/path_parser.rs
@@ -232,7 +232,7 @@ impl<'b> PathParser<'b> {
                 let mut c: char = ' ';
 
                 while self.lookahead_is_digit (&mut c) {
-                    fraction = fraction / 10.0;
+                    fraction /= 10.0;
                     value += fraction * f64::from(char_to_digit (c));
 
                     assert! (self.match_char (c));
diff --git a/rust/src/property_bag.rs b/rust/src/property_bag.rs
index 2c8d09a..59b615a 100644
--- a/rust/src/property_bag.rs
+++ b/rust/src/property_bag.rs
@@ -45,7 +45,7 @@ pub fn parse_or_none<T> (pbag: *const RsvgPropertyBag,
                 .and_then (|v|
                            if let Some(validate) = validate {
                                validate(v)
-                                   .map(|v| Some(v))
+                                   .map(Some)
                            } else {
                                Ok(Some(v))
                            })
diff --git a/rust/src/shapes.rs b/rust/src/shapes.rs
index 6371f7c..07516bc 100644
--- a/rust/src/shapes.rs
+++ b/rust/src/shapes.rs
@@ -92,7 +92,7 @@ impl NodeTrait for NodePath {
         if let Some (value) = property_bag::lookup (pbag, "d") {
             let mut builder = self.builder.borrow_mut ();
 
-            if let Err (_) = path_parser::parse_path_into_builder (&value, &mut *builder) {
+            if path_parser::parse_path_into_builder (&value, &mut *builder).is_err() {
                 // FIXME: we don't propagate errors upstream, but creating a partial
                 // path is OK per the spec
             }


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