Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow multiple args to dbg!(..)
  • Loading branch information
llogiq committed Apr 10, 2019
commit 8816a9ac1fbb2c35128ab2e1e3fd1032178bacc3
10 changes: 10 additions & 0 deletions src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ macro_rules! eprintln {
/// You can also use `dbg!()` without a value to just print the
/// file and line whenever it's reached.
///
/// Finally, if you want to `dbg!(..)` multiple values, it will treat them as
/// a tuple (and return it, too):
///
/// ```
/// assert_eq!(dbg!(1usize, 2u32), (1, 2));
/// ```
///
/// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)
/// [`debug!`]: https://docs.rs/log/*/log/macro.debug.html
/// [`log`]: https://crates.io/crates/log
Expand All @@ -333,6 +340,9 @@ macro_rules! dbg {
tmp
}
}
};
($val:expr, $($more:expr),+) => {
dbg!(($val, $($more),*))
}
}

Expand Down