Skip to content

Commit

Permalink
Revert "Suppress unused variable warning for debug_print macros (#1258)…
Browse files Browse the repository at this point in the history
…" (#1276)

* Revert "Suppress unused variable warning for debug_print macros (#1258)"

This reverts commit b6dd935.

* Add workaround for unused bug
  • Loading branch information
cmichi authored May 25, 2022
1 parent 260946f commit b25d6b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
22 changes: 6 additions & 16 deletions crates/env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)*) => ();
}
}
}
4 changes: 2 additions & 2 deletions examples/mother/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit b25d6b8

Please sign in to comment.