fix: Amend error message when deriving enums

Backported from v4. Original change: https://github.com/clap-rs/clap/pull/4118
This commit is contained in:
Miguel Fernandez 2022-08-26 16:57:42 +02:00
parent 88b941f87b
commit dae2bb765f
2 changed files with 2 additions and 2 deletions

View file

@ -84,7 +84,7 @@ fn lits(
None
} else {
if !matches!(variant.fields, Fields::Unit) {
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped");
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped");
}
let fields = attrs.field_methods(false);
let name = attrs.cased_name();

View file

@ -1,4 +1,4 @@
error: `#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped
error: `#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped
--> tests/derive_ui/value_enum_non_unit.rs:5:5
|
5 | Foo(usize),