Skip to content

Commit 0d5e35f

Browse files
committed
Stop dbg! macro yapping about format modifiers
1 parent e79e01c commit 0d5e35f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

std/src/macros.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,14 @@ macro_rules! dbg {
363363
match $val {
364364
tmp => {
365365
$crate::eprintln!("[{}:{}:{}] {} = {:#?}",
366-
$crate::file!(), $crate::line!(), $crate::column!(), $crate::stringify!($val), &tmp);
366+
$crate::file!(),
367+
$crate::line!(),
368+
$crate::column!(),
369+
$crate::stringify!($val),
370+
// The `&T: Debug` check happens here (not in the format literal desugaring)
371+
// to avoid format literal related messages and suggestions.
372+
&&tmp as &dyn $crate::fmt::Debug,
373+
);
367374
tmp
368375
}
369376
}

0 commit comments

Comments
 (0)