Skip to content

Commit dae2bb7

Browse files
committed
fix: Amend error message when deriving enums
Backported from v4. Original change: #4118
1 parent 88b941f commit dae2bb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clap_derive/src/derives/value_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn lits(
8484
None
8585
} else {
8686
if !matches!(variant.fields, Fields::Unit) {
87-
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped");
87+
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped");
8888
}
8989
let fields = attrs.field_methods(false);
9090
let name = attrs.cased_name();

tests/derive_ui/value_enum_non_unit.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped
1+
error: `#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped
22
--> tests/derive_ui/value_enum_non_unit.rs:5:5
33
|
44
5 | Foo(usize),

0 commit comments

Comments
 (0)