From 2b94d70a38ebea00ca394b0e7e9e33623cba4902 Mon Sep 17 00:00:00 2001 From: William Venner Date: Wed, 6 Oct 2021 18:22:55 +0100 Subject: [PATCH] Fix more macro hygiene --- gmod/src/hax.rs | 2 +- gmod/src/lua/mod.rs | 2 +- gmod/src/msgc.rs | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gmod/src/hax.rs b/gmod/src/hax.rs index 0c4756a..9571ef4 100644 --- a/gmod/src/hax.rs +++ b/gmod/src/hax.rs @@ -2,7 +2,7 @@ /// Common pattern for detouring. macro_rules! find_gmod_signature { (($library:ident, $library_path:ident), @EXPORT = $export:literal) => { - $library.get(concat!($export, '\0').as_bytes()).ok().map(|func: ::gmod::libloading::Symbol<'_, _>| *func) + $library.get(concat!($export, '\0').as_bytes()).ok().map(|func: $crate::libloading::Symbol<'_, _>| *func) }; (($library:ident, $library_path:ident), @SIG = $sig:literal) => { diff --git a/gmod/src/lua/mod.rs b/gmod/src/lua/mod.rs index 66c898e..77cc56d 100644 --- a/gmod/src/lua/mod.rs +++ b/gmod/src/lua/mod.rs @@ -41,6 +41,6 @@ pub enum LuaError { #[macro_export] macro_rules! lua_string { ( $str:literal ) => { - ::gmod::cstr::cstr!($str).as_ptr() + $crate::cstr::cstr!($str).as_ptr() }; } diff --git a/gmod/src/msgc.rs b/gmod/src/msgc.rs index 2099536..39a5795 100644 --- a/gmod/src/msgc.rs +++ b/gmod/src/msgc.rs @@ -61,21 +61,21 @@ lazy_static::lazy_static! { } #[macro_export] macro_rules! colormsg { - ($($($arg:expr)+),+) => { - $(::gmod::msgc::colormsg!(@print $($arg)+));+ + ($($arg:tt),+) => { + $($crate::colormsg!(@print $arg));+ }; (@print [$r:literal, $g:literal, $b:literal] $fmt:literal % ($($arg:tt),+)) => { - ::gmod::msgc::ConColorMsg( - &::gmod::msgc::Color::new($r, $g, $b), - ::gmod::msgc::printf_escape(format!(concat!($fmt, '\0'), $($arg),+)).as_ptr() as *const _, + $crate::msgc::ConColorMsg( + &$crate::msgc::Color::new($r, $g, $b), + $crate::msgc::printf_escape(format!(concat!($fmt, '\0'), $($arg),+)).as_ptr() as *const _, ) }; (@print [$r:literal, $g:literal, $b:literal] $str:literal) => { - ::gmod::msgc::ConColorMsg( - &::gmod::msgc::Color::new($r, $g, $b), - ::gmod::msgc::printf_escape(concat!($str, '\0')).as_ptr() as *const _, + $crate::msgc::ConColorMsg( + &$crate::msgc::Color::new($r, $g, $b), + $crate::msgc::printf_escape(concat!($str, '\0')).as_ptr() as *const _, ) }; }