Skip to content

Commit 221177b

Browse files
committed
fix(assert): Call out the action in positional assert
Brought up in #5135
1 parent cb2d2bc commit 221177b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clap_builder/src/builder/debug_asserts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,9 @@ fn assert_arg(arg: &Arg) {
746746
);
747747
assert!(
748748
arg.is_takes_value_set(),
749-
"Argument '{}` is positional, it must take a value{}",
749+
"Argument '{}` is positional and it must take a value but action is {:?}{}",
750750
arg.get_id(),
751+
arg.get_action(),
751752
if arg.get_id() == Id::HELP {
752753
" (`mut_arg` no longer works with implicit `--help`)"
753754
} else if arg.get_id() == Id::VERSION {

tests/builder/multiple_values.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ fn issue_2229() {
17301730
}
17311731

17321732
#[test]
1733-
#[should_panic = "Argument 'pos` is positional, it must take a value"]
1733+
#[should_panic = "Argument 'pos` is positional and it must take a value but action is SetTrue"]
17341734
fn disallow_positionals_without_values() {
17351735
let cmd = Command::new("test").arg(Arg::new("pos").num_args(0));
17361736
cmd.debug_assert();

0 commit comments

Comments
 (0)