From 329d1a63ab39080e28f9bd8836280adc54b53d47 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 11 Apr 2022 17:44:54 +0200 Subject: [PATCH] Use $crate in the macros to refer to other macros So you don't need to import all of them for them to work. --- src/debug.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/debug.rs b/src/debug.rs index eb1cc3fa..c8206a49 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -19,12 +19,12 @@ macro_rules! nih_log { macro_rules! nih_debug_assert { ($cond:expr $(,)?) => ( if cfg!(debug_assertions) && !$cond { - nih_log!(concat!("Debug assertion failed: ", stringify!($cond))); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($cond))); } ); ($cond:expr, $format:expr $(, $($args:tt)*)?) => ( if cfg!(debug_assertions) && !$cond { - nih_log!(concat!("Debug assertion failed: ", stringify!($cond), ", ", $format), $($($args)*)?); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($cond), ", ", $format), $($($args)*)?); } ); } @@ -35,12 +35,12 @@ macro_rules! nih_debug_assert { macro_rules! nih_debug_assert_failure { () => ( if cfg!(debug_assertions) { - nih_log!("Debug assertion failed"); + $crate::nih_log!("Debug assertion failed"); } ); ($format:expr $(, $($args:tt)*)?) => ( if cfg!(debug_assertions) { - nih_log!(concat!("Debug assertion failed: ", $format), $($($args)*)?); + $crate::nih_log!(concat!("Debug assertion failed: ", $format), $($($args)*)?); } ); } @@ -51,12 +51,12 @@ macro_rules! nih_debug_assert_failure { macro_rules! nih_debug_assert_eq { ($left:expr, $right:expr $(,)?) => ( if cfg!(debug_assertions) && $left != $right { - nih_log!(concat!("Debug assertion failed: ", stringify!($left), " != ", stringify!($right))); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($left), " != ", stringify!($right))); } ); ($left:expr, $right:expr, $format:expr $(, $($args:tt)*)?) => ( if cfg!(debug_assertions) && $left != $right { - nih_log!(concat!("Debug assertion failed: ", stringify!($left), " != ", stringify!($right), ", ", $format), $($($args)*)?); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($left), " != ", stringify!($right), ", ", $format), $($($args)*)?); } ); } @@ -67,12 +67,12 @@ macro_rules! nih_debug_assert_eq { macro_rules! nih_debug_assert_ne { ($left:expr, $right:expr $(,)?) => ( if cfg!(debug_assertions) && $left == $right { - nih_log!(concat!("Debug assertion failed: ", stringify!($left), " == ", stringify!($right))); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($left), " == ", stringify!($right))); } ); ($left:expr, $right:expr, $format:expr $(, $($args:tt)*)?) => ( if cfg!(debug_assertions) && $left == $right { - nih_log!(concat!("Debug assertion failed: ", stringify!($left), " == ", stringify!($right), ", ", $format), $($($args)*)?); + $crate::nih_log!(concat!("Debug assertion failed: ", stringify!($left), " == ", stringify!($right), ", ", $format), $($($args)*)?); } ); }