[librsvg: 43/51] color_matrix.rs: impl Default for OperationType



commit af9fec43605e89d7523793b2147c7ec877c6a97e
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 18 10:44:03 2019 -0600

    color_matrix.rs: impl Default for OperationType
    
    Instead of using the default value explicitly in the middle of the
    code; this should make it more clear that the default comes from the spec.

 rsvg_internals/src/filters/color_matrix.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index f64bfe44..0fb1c69a 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -26,6 +26,12 @@ enum OperationType {
     LuminanceToAlpha,
 }
 
+impl Default for OperationType {
+    fn default() -> Self {
+        OperationType::Matrix
+    }
+}
+
 /// The `feColorMatrix` filter primitive.
 pub struct FeColorMatrix {
     base: PrimitiveWithInput,
@@ -50,7 +56,7 @@ impl NodeTrait for FeColorMatrix {
         self.base.set_atts(parent, pbag)?;
 
         // First, determine the operation type.
-        let mut operation_type = OperationType::Matrix;
+        let mut operation_type = Default::default();
         for (attr, value) in pbag
             .iter()
             .filter(|(attr, _)| attr.expanded() == expanded_name!(svg "type"))


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