Преглед изворни кода

Suppress unused variable warnings in net_trace!.

whitequark пре 8 година
родитељ
комит
88b163f63a
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      src/lib.rs

+ 4 - 2
src/lib.rs

@@ -16,9 +16,11 @@ extern crate alloc;
 extern crate log;
 
 macro_rules! net_trace {
-    ($($arg:tt)*) => {
+    ($($arg:expr),*) => {
         #[cfg(feature = "use_log")]
-        trace!($($arg)*)
+        trace!($($arg),*);
+        #[cfg(not(feature = "use_log"))]
+        $( let _ = $arg );*; // suppress unused variable warnings
     }
 }