mcarton / rust-derivative

A set of alternative `derive` attributes for Rust
Apache License 2.0
420 stars 46 forks source link

Using `derive(Derivative)` with no further attribute should be an error #86

Open mcarton opened 3 years ago

mcarton commented 3 years ago

Eg.

#[derive(derivative::Derivative)]
struct Error;

should not compile. Less contrived example:

#[derive(derivative::Derivative)]
#[derive(Clone)] // user probably meant to use `#[derivative(Clone)]` here
struct Error;

For instance, the following:

#[derive]
struct Error;

generates

error: malformed `derive` attribute input
 --> src/lib.rs:1:1
  |
1 | #[derive]
  | ^^^^^^^^^ help: missing traits to be derived: `#[derive(Trait1, Trait2, ...)]`