fix(derive): Provide derive-friendly deprecation messages #3832
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a step towards #3822. I'd say this fixes it but I'd want some
user acceptance before doing so.
To do this, we
ArgMatches
deprecation messages with assumption being that any message from these has its roots in anaugment_args
deprecation. You can see the raw deprecations withclap_derive/raw-deprecation
parse
case.Arg
methods, delegating to the messages for the generated functionsWe intentionally do not provide a deprecation message for implicit
parse
attributes since resolving that is just busywork that most likely won't help users in migrating to clap 4.I had originally assumed this would be difficult to be precise in our
allow
and deprecations but I found place to split up the calls. Its not completely precise but it should be good enough in the short term.Example messages
PathBuf
and correctly set theparse(from_os_str)
. Correctly detecting this to not show it would add another level of work and we'd need to have some way to tell users when they upgrade to clap 4 what the correct replacement forparse(from_os_str)
is (nothing).parse(from_str)
,. etc