Skip to content

Unexpected arguments are incorrectly identified #359

Closed
@dtolnay

Description

@dtolnay

Something about how the command-line arguments are being parsed with Clap makes worse errors than other Cargo subcommand usages of Clap.

This error confusingly says that bisect-rustc is unexpected, not that --components is unexpected. (The correct flag is called --component and Clap should know to suggest this.)

$ cargo bisect-rustc --components=clippy
error: unexpected argument 'bisect-rustc' found

Usage: cargo bisect-rustc [OPTIONS] [-- <COMMAND_ARGS>...]

For more information, try '--help'.

Compared to these, which both correctly identify --components as unexpected.

$ cargo expand --components=clippy
error: unexpected argument '--components' found

  tip: to pass '--components' as a value, use '-- --components'

Usage: cargo expand [OPTIONS] [ITEM]

For more information, try '--help'.
$ cargo docs-rs --components=clippy
error: unexpected argument '--components' found

  tip: a similar argument exists: '--open'

Usage: cargo docs-rs <--open|--verbose|--color <WHEN>|--version|--package <SPEC>|--jobs <N>|--target <TARGET>|--target-dir <DIRECTORY>|--manifest-path <PATH>|--frozen|--locked|--offline>

For more information, try '--help'.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions