[librsvg: 1/2] Fix or suppress clippy warnings




commit 53de7bab86f4554c320e687b40abc862a9ee30ac
Author: Sven Neumann <sven svenfoo org>
Date:   Thu Mar 25 23:22:46 2021 +0100

    Fix or suppress clippy warnings
    
    Clippy complained about functions that unnecessarily wrap their return
    value into Result even though they do not ever return an Err.
    
    https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
    
    In one place Clippy seems right and I followed its advice to remove
    the Result. The two other places actually should rather be changed
    to return errors. The code already has comments stating that and I
    attributed the code now to suppress the Clippy warnings.

 src/element.rs     | 1 +
 src/filters/mod.rs | 8 ++++----
 src/properties.rs  | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/element.rs b/src/element.rs
index 60f908e2..ad3c36a3 100644
--- a/src/element.rs
+++ b/src/element.rs
@@ -225,6 +225,7 @@ impl<T: SetAttributes + Draw> ElementInner<T> {
     }
 
     /// Hands the `attrs` to the node's state, to apply the presentation attributes.
+    #[allow(clippy::unnecessary_wraps)]
     fn set_presentation_attributes(&mut self) -> Result<(), ElementError> {
         match self
             .specified_values
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 54ce8e8f..ba8a6f5d 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -132,14 +132,14 @@ impl Parse for Input {
 }
 
 impl Primitive {
-    fn resolve(&self) -> Result<ResolvedPrimitive, FilterError> {
-        Ok(ResolvedPrimitive {
+    fn resolve(&self) -> ResolvedPrimitive {
+        ResolvedPrimitive {
             x: self.x,
             y: self.y,
             width: self.width,
             height: self.height,
             result: self.result.clone(),
-        })
+        }
     }
 }
 
@@ -297,7 +297,7 @@ pub fn render(
             .resolve(&c)
             .and_then(|(primitive, params)| {
                 render_primitive(
-                    &primitive.resolve()?,
+                    &primitive.resolve(),
                     &params,
                     &filter_ctx,
                     acquired_nodes,
diff --git a/src/properties.rs b/src/properties.rs
index a2b94ee4..2a676578 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -637,6 +637,7 @@ impl SpecifiedValues {
         }
     }
 
+    #[allow(clippy::unnecessary_wraps)]
     fn parse_one_presentation_attribute(
         &mut self,
         attr: QualName,


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