[librsvg: 7/16] clippy: use $crate in macros




commit 82926910344c223cd223b3fd753c0b36fe07a750
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 15 15:51:57 2022 -0500

    clippy: use $crate in macros
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/747>

 src/node.rs            |  4 ++--
 src/property_macros.rs | 18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/node.rs b/src/node.rs
index 52f655a5a..ae08cf3fe 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -249,7 +249,7 @@ macro_rules! is_element_of_type {
     ($node:expr, $element_type:ident) => {
         matches!(
             *$node.borrow_element(),
-            crate::element::Element::$element_type(_)
+            $crate::element::Element::$element_type(_)
         )
     };
 }
@@ -258,7 +258,7 @@ macro_rules! is_element_of_type {
 macro_rules! borrow_element_as {
     ($node:expr, $element_type:ident) => {
         std::cell::Ref::map($node.borrow_element(), |e| match *e {
-            crate::element::Element::$element_type(ref e) => &*e,
+            $crate::element::Element::$element_type(ref e) => &*e,
             _ => panic!("tried to borrow_element_as {}", stringify!($element_type)),
         })
     };
diff --git a/src/property_macros.rs b/src/property_macros.rs
index 0afc58058..0a51649e9 100644
--- a/src/property_macros.rs
+++ b/src/property_macros.rs
@@ -121,8 +121,8 @@ macro_rules! make_property {
         impl_default!($name, $name::$default);
         impl_property!($name, $inherits_automatically);
 
-        impl crate::parsers::Parse for $name {
-            fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name, 
crate::error::ParseError<'i>> {
+        impl $crate::parsers::Parse for $name {
+            fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name, 
$crate::error::ParseError<'i>> {
                 Ok(parse_identifiers!(
                     parser,
                     $($str_prop => $name::$variant,)+
@@ -147,8 +147,8 @@ macro_rules! make_property {
         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>> {
+        impl $crate::parsers::Parse for $name {
+            fn parse<'i>(parser: &mut ::cssparser::Parser<'i, '_>) -> Result<$name, 
$crate::error::ParseError<'i>> {
                 Ok(parse_identifiers!(
                     parser,
                     $($str_prop => $name::$variant,)+
@@ -170,9 +170,9 @@ macro_rules! make_property {
         impl_default!($name, $name($default));
         impl_property!($name, $inherits_automatically);
 
-        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)?))
+        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)?))
             }
         }
     };
@@ -275,12 +275,12 @@ macro_rules! impl_default {
 
 macro_rules! impl_property {
     ($name:ident, $inherits_automatically:expr) => {
-        impl crate::property_macros::Property for $name {
+        impl $crate::property_macros::Property for $name {
             fn inherits_automatically() -> bool {
                 $inherits_automatically
             }
 
-            fn compute(&self, _v: &crate::properties::ComputedValues) -> Self {
+            fn compute(&self, _v: &$crate::properties::ComputedValues) -> Self {
                 self.clone()
             }
         }


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