[librsvg: 8/9] Avoid returning an Err with the ? operator if possible



commit 7b308c42ffb34360eb4d14ff09001500e32c4f06
Author: Sven Neumann <sven svenfoo org>
Date:   Thu Jan 30 09:30:22 2020 +0100

    Avoid returning an Err with the ? operator if possible
    
    https://rust-lang.github.io/rust-clippy/master/index.html#try_err

 rsvg_internals/src/filters/convolve_matrix.rs | 2 +-
 rsvg_internals/src/iri.rs                     | 2 +-
 rsvg_internals/src/length.rs                  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index de6c1ca8..baddbd18 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -66,7 +66,7 @@ impl NodeTrait for FeConvolveMatrix {
                             if v.0 > 0 && v.1 > 0 {
                                 Ok(v)
                             } else {
-                                Err(ValueErrorKind::value_error("values must be greater than 0"))?
+                                Err(ValueErrorKind::value_error("values must be greater than 0"))
                             }
                         })?;
                     self.order = (x as u32, y as u32);
diff --git a/rsvg_internals/src/iri.rs b/rsvg_internals/src/iri.rs
index 49bc393a..16166419 100644
--- a/rsvg_internals/src/iri.rs
+++ b/rsvg_internals/src/iri.rs
@@ -53,7 +53,7 @@ impl Parse for IRI {
             match href {
                 Href::PlainUrl(_) => Err(loc.new_custom_error(ValueErrorKind::parse_error(
                     "href requires a fragment identifier",
-                )))?,
+                ))),
                 Href::WithFragment(f) => Ok(IRI::Resource(f)),
             }
         }
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index be8f58ef..a188baae 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -258,11 +258,11 @@ impl<N: Normalize> Parse for Length<N> {
                         "pt" => Length::new(value, LengthUnit::Pt),
                         "pc" => Length::new(value, LengthUnit::Pc),
 
-                        _ => return Err(parser.new_unexpected_token_error(token.clone()))?,
+                        _ => return Err(parser.new_unexpected_token_error(token.clone())),
                     }
                 }
 
-                _ => return Err(parser.new_unexpected_token_error(token.clone()))?,
+                _ => return Err(parser.new_unexpected_token_error(token.clone())),
             }
         };
 


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