From b713835894454cd0246dd80e13ce72cb056c82b0 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Tue, 6 Aug 2024 22:35:03 +0200 Subject: [PATCH] Improve error when not enabling any features --- impl/src/lib.rs | 4 ++++ src/lib.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/impl/src/lib.rs b/impl/src/lib.rs index a4ecebc0..eeccdb07 100644 --- a/impl/src/lib.rs +++ b/impl/src/lib.rs @@ -72,6 +72,10 @@ mod unwrap; // the derives. A derive can generally be infallible and // return a TokenStream, or it can be fallible and return // a Result. +// +// This trait can be unused if no feature is enabled. We already error in that case but this +// warning distracts from the actual error. +#[allow(dead_code)] trait Output { fn process(self) -> TokenStream; } diff --git a/src/lib.rs b/src/lib.rs index 6230cdb8..b201da74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -70,6 +70,9 @@ pub mod __private { /// /// Use it in your import paths, if you don't want to import traits, but only macros. pub mod derive { + // This can be unused if no feature is enabled. We already error in that case, but this warning + // distracts from that error. So we suppress the warning. + #[allow(unused_imports)] #[doc(inline)] pub use derive_more_impl::*; } @@ -443,5 +446,5 @@ pub use derive_more_impl::*; feature = "unwrap", )))] compile_error!( - "at least one derive feature must be enabled (or the \"full\" one enabling all the derives)" + "at least one derive feature must be enabled (or the \"full\" feature enabling all the derives)" );