chiark / gitweb /
utils: Improve display_as_debug! so it can pass generic params
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 25 Jan 2021 19:26:53 +0000 (19:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Jan 2021 23:24:05 +0000 (23:24 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/error.rs

index 676acb65e8db22490711d45924458854b7a6cb95..22d9f97e76f0209a97e2c4d7d806f0cc6375db2b 100644 (file)
@@ -181,8 +181,8 @@ impl IdForById for PieceId {
 
 #[macro_export]
 macro_rules! display_as_debug {
-  {$x:ty} => {
-    impl std::fmt::Display for $x {
+  {$x:ty $( , $($gen_tt:tt)* )?} => {
+    impl $( $($gen_tt)* )? std::fmt::Display for $x {
       #[throws(std::fmt::Error)]
       fn fmt(&self, f: &mut std::fmt::Formatter) {
         <Self as Debug>::fmt(self, f)?