[librsvg: 8/22] Remove the unused pattern in make_property!



commit a8d18c41839834f32788b4b2a13bbf29caa5d923
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Jun 25 18:18:09 2020 -0500

    Remove the unused pattern in make_property!

 rsvg_internals/src/property_macros.rs | 53 -----------------------------------
 1 file changed, 53 deletions(-)
---
diff --git a/rsvg_internals/src/property_macros.rs b/rsvg_internals/src/property_macros.rs
index 6fbebc88..41b900e1 100644
--- a/rsvg_internals/src/property_macros.rs
+++ b/rsvg_internals/src/property_macros.rs
@@ -75,26 +75,6 @@ macro_rules! make_property {
         }
     };
 
-    ($computed_values_type: ty,
-     $name: ident,
-     default: $default: expr,
-     newtype_parse: $type: ty,
-     property_impl: { $prop: item }
-    ) => {
-        #[derive(Debug, Clone, PartialEq)]
-        pub struct $name(pub $type);
-
-        impl_default!($name, $name($default));
-
-        $prop
-
-        impl crate::parsers::Parse for $name {
-            fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name, 
crate::error::ParseError<'i>> {
-                Ok($name(<$type as crate::parsers::Parse>::parse(parser)?))
-            }
-        }
-    };
-
     ($computed_values_type: ty,
      $name: ident,
      default: $default: expr,
@@ -188,7 +168,6 @@ mod tests {
     use super::*;
 
     use crate::parsers::Parse;
-    use cssparser::RGBA;
 
     #[test]
     fn check_identifiers_property() {
@@ -209,36 +188,4 @@ mod tests {
         assert!(<Foo as Parse>::parse_str("blargh").is_err());
         assert_eq!(<Foo as Parse>::parse_str("bar"), Ok(Foo::Bar));
     }
-
-    #[test]
-    fn check_compute() {
-        make_property! {
-            RGBA,
-            AddColor,
-            default: RGBA::new(1, 1, 1, 1),
-            newtype_parse: RGBA,
-            property_impl: {
-                impl Property<RGBA> for AddColor {
-                    fn inherits_automatically() -> bool {
-                        true
-                    }
-
-                    fn compute(&self, v: &RGBA) -> Self {
-                        AddColor(RGBA::new(
-                            self.0.red + v.red,
-                            self.0.green + v.green,
-                            self.0.blue + v.blue,
-                            self.0.alpha + v.alpha
-                        ))
-                    }
-                }
-            }
-        }
-
-        let color = RGBA::new(1, 1, 1, 1);
-        let a = <AddColor as Parse>::parse_str("#02030405").unwrap();
-        let b = a.compute(&color);
-
-        assert_eq!(b, AddColor(RGBA::new(3, 4, 5, 6)));
-    }
 }


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