Skip to content

Commit

Permalink
Improve error when not enabling any features
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Aug 6, 2024
1 parent 330e425 commit b713835
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TokenStream, syn::parse::Error>.
//
// 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;
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
}
Expand Down Expand Up @@ -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)"
);

0 comments on commit b713835

Please sign in to comment.