melib: return $val in debug!

embed
Manos Pitsidianakis 2019-05-12 17:37:07 +03:00
parent f972f69bad
commit 1e7e99f499
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ pub mod dbg {
#[macro_export]
macro_rules! debug {
($val:literal) => {
{
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
@ -36,8 +37,11 @@ pub mod dbg {
);
eprintln!($val);
}
$val
}
};
($val:expr) => {
{
if cfg!(debug_assertions) {
eprint!(
"[{:?}] {}:{}_{}: ",
@ -51,6 +55,8 @@ pub mod dbg {
);
eprintln!("{} = {:?}", stringify!($val), $val);
}
$val
}
};
($fmt:literal, $($arg:tt)*) => {
if cfg!(debug_assertions) {