Skip to content

Commit

Permalink
fix: Amend error message when deriving enums
Browse files Browse the repository at this point in the history
Backported from v4. Original change: #4118
  • Loading branch information
miguelff committed Aug 26, 2022
1 parent 88b941f commit dae2bb7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clap_derive/src/derives/value_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/derive_ui/value_enum_non_unit.stderr
Original file line number Diff line number Diff line change
@@ -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),
Expand Down

0 comments on commit dae2bb7

Please sign in to comment.