summaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-06-07 03:21:09 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-06-07 03:21:37 +0200
commit3be49d3e794d5819574fe33ffbfda9da1ddbe216 (patch)
tree30ac3b89de123efd2e6a6d9cc250783f9df6f699 /embassy-rp
parentef1ebefec0c682553213406b3e59a30a79520291 (diff)
downloadembassy-3be49d3e794d5819574fe33ffbfda9da1ddbe216.zip
fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled.
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/src/fmt.rs42
1 files changed, 26 insertions, 16 deletions
diff --git a/embassy-rp/src/fmt.rs b/embassy-rp/src/fmt.rs
index 2646c57a..06697081 100644
--- a/embassy-rp/src/fmt.rs
+++ b/embassy-rp/src/fmt.rs
@@ -104,56 +104,66 @@ macro_rules! panic {
}
macro_rules! trace {
- ($($x:tt)*) => {
+ ($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
- ::log::trace!($($x)*);
+ ::log::trace!($s $(, $x)*);
#[cfg(feature = "defmt")]
- ::defmt::trace!($($x)*);
+ ::defmt::trace!($s $(, $x)*);
+ #[cfg(not(any(feature = "log", feature="defmt")))]
+ let _ = ($( & $x ),*);
}
};
}
macro_rules! debug {
- ($($x:tt)*) => {
+ ($s:literal $(, $x:expr)* $(,)?) => {
{
- #[cfg(fevature = "log")]
- ::log::debug!($($x)*);
+ #[cfg(feature = "log")]
+ ::log::debug!($s $(, $x)*);
#[cfg(feature = "defmt")]
- ::defmt::debug!($($x)*);
+ ::defmt::debug!($s $(, $x)*);
+ #[cfg(not(any(feature = "log", feature="defmt")))]
+ let _ = ($( & $x ),*);
}
};
}
macro_rules! info {
- ($($x:tt)*) => {
+ ($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
- ::log::info!($($x)*);
+ ::log::info!($s $(, $x)*);
#[cfg(feature = "defmt")]
- ::defmt::info!($($x)*);
+ ::defmt::info!($s $(, $x)*);
+ #[cfg(not(any(feature = "log", feature="defmt")))]
+ let _ = ($( & $x ),*);
}
};
}
macro_rules! warn {
- ($($x:tt)*) => {
+ ($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
- ::log::warn!($($x)*);
+ ::log::warn!($s $(, $x)*);
#[cfg(feature = "defmt")]
- ::defmt::warn!($($x)*);
+ ::defmt::warn!($s $(, $x)*);
+ #[cfg(not(any(feature = "log", feature="defmt")))]
+ let _ = ($( & $x ),*);
}
};
}
macro_rules! error {
- ($($x:tt)*) => {
+ ($s:literal $(, $x:expr)* $(,)?) => {
{
#[cfg(feature = "log")]
- ::log::error!($($x)*);
+ ::log::error!($s $(, $x)*);
#[cfg(feature = "defmt")]
- ::defmt::error!($($x)*);
+ ::defmt::error!($s $(, $x)*);
+ #[cfg(not(any(feature = "log", feature="defmt")))]
+ let _ = ($( & $x ),*);
}
};
}