Skip to content

Why does subcommand returns (&str, Option<&ArgMatches<'a>>) and not Option<(&str, &ArgMatches<'a>)> ? #2047

Answered by CreepySkeleton
pgimalac asked this question in Q&A
Discussion options

You must be logged in to vote

For example is it possible to have (non-empty str, None) ?

Doesn't seem so.


This is a good question. I'd say historical reasons are operative here: this was apparently the way it had been done initially, and nobody seemed to care enough to raise the question afterwards.

Okay, I agree that having both name and matches wrapped in Option would be better. Additionally, we wouldn't need ArgMatches to be wrapped in its own Option; I never saw anybody using it in a way that wasn't a logical equivalent to "unwrap or ignore".

Addressed in #2048

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pgimalac
Comment options

Answer selected by pgimalac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants