#[allow(unused_macros)]
macro_rules! hide_from_rustfmt {
    ($mod:item) => {
        $mod
    };
}

#[cfg(not(all(
    feature = "derive",
    feature = "full",
    feature = "parsing",
    feature = "printing",
    feature = "visit",
    feature = "visit-mut",
    feature = "fold",
    feature = "clone-impls",
    feature = "extra-traits",
    feature = "proc-macro",
)))]
hide_from_rustfmt! {
    mod error;
}

macro_rules! hide_from_rustfmt {
    ($($tt:tt)*) => {
        $($tt)*
    };
}

#[cfg(not(all(
    feature = "derive",
    feature = "full",
    feature = "parsing",
    feature = "printing",
    feature = "visit",
    feature = "visit-mut",
    feature = "fold",
    feature = "clone-impls",
    feature = "extra-traits",
    feature = "proc-macro",
)))]
hide_from_rustfmt! {
    mod error;
}

--- 
+++ 
@@ -1,7 +1,6 @@
-#[allow(unused_macros)]
 macro_rules! hide_from_rustfmt {
-    ($mod:item) => {
-        $mod
+    ($($tt:tt)*) => {
+        $($tt)*
     };
 }
 
Hide warning when tests/features/error is not triggered
