Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 18, 2019 00:18
Show Gist options
  • Save rust-play/033c5fe4ee70421722f20da2532bbc28 to your computer and use it in GitHub Desktop.
Save rust-play/033c5fe4ee70421722f20da2532bbc28 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
macro_rules! debug_dbg {
($($x: tt)*) => {{
if cfg!(debug_assertions) {
dbg!($($x)*)
} else {
$($x)*
}
}}
}
fn main() {
let x = 2;
debug_dbg!(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment