From b25d6b8985612ff45a0319c20f0da5a97510efef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 25 May 2022 10:21:06 +0200 Subject: [PATCH] Revert "Suppress unused variable warning for debug_print macros (#1258)" (#1276) * Revert "Suppress unused variable warning for debug_print macros (#1258)" This reverts commit b6dd935240b8140787593cbdc79a15f6fbca5f59. * Add workaround for unused bug --- crates/env/src/lib.rs | 22 ++++++---------------- examples/mother/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/crates/env/src/lib.rs b/crates/env/src/lib.rs index 23a51fecce3..306b6ea774e 100644 --- a/crates/env/src/lib.rs +++ b/crates/env/src/lib.rs @@ -131,7 +131,7 @@ cfg_if::cfg_if! { /// `"pallet-contracts/unstable-interface"` feature to be enabled in the target runtime. #[macro_export] macro_rules! debug_print { - ($($arg:expr),*) => ($crate::debug_message(&$crate::format!($($arg),*))); + ($($arg:tt)*) => ($crate::debug_message(&$crate::format!($($arg)*))); } /// Appends a formatted string to the `debug_message` buffer, as per [`debug_print`] but @@ -144,32 +144,22 @@ cfg_if::cfg_if! { #[macro_export] macro_rules! debug_println { () => ($crate::debug_print!("\n")); - ($($arg:expr),*) => ( - $crate::debug_print!("{}\n", $crate::format!($($arg),*)); + ($($arg:tt)*) => ( + $crate::debug_print!("{}\n", $crate::format!($($arg)*)); ) } } else { #[macro_export] /// Debug messages disabled. Enable the `ink-debug` feature for contract debugging. macro_rules! debug_print { - ($($arg:expr),*) => - { - { - let _ = || ($(&$arg),*); - } - }; + ($($arg:tt)*) => (); } #[macro_export] /// Debug messages disabled. Enable the `ink-debug` feature for contract debugging. macro_rules! debug_println { - () => {}; - ($($arg:expr),*) => - { - { - let _ = || ($(&$arg),*); - } - }; + () => (); + ($($arg:tt)*) => (); } } } diff --git a/examples/mother/lib.rs b/examples/mother/lib.rs index 1f9b827b82a..7571481439d 100755 --- a/examples/mother/lib.rs +++ b/examples/mother/lib.rs @@ -219,8 +219,8 @@ mod mother { /// Prints the specified string into node's debug log. #[ink(message)] - pub fn debug_log(&mut self, message: String) { - ink_env::debug_println!("debug_log: {}", message); + pub fn debug_log(&mut self, _message: String) { + ink_env::debug_println!("debug_log: {}", _message); } }