Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change IntoApp::into_app to CommandFactory::command #3473

Merged
merged 2 commits into from Feb 15, 2022

Conversation

epage
Copy link
Member

@epage epage commented Feb 15, 2022

This is a follow up to #3472 and is part of resolving #3089.

With Command renamed, we need to handle the renaming of IntoApp::into_app. into_* functions are meant to take self as a parameter (see https://rust-lang.github.io/api-guidelines/naming.html#c-conv) which this does not. I think switching to command is sufficient for the function. That leaves naming the trait. Java has given a lot of us a negative feeling towards the name Factory but calling this a CommandFactory is the best, descriptive name I've been able to come up with.

For compatibility, we pub use CommandFactory as IntoApp and have command() be an inherent function that calls the deprecated into_app. While in #3472, I shied away from using use because it doesn't trigger the deprecation warning, this was the best option I had for a trait. This at least ensures all new users will use the new name and existing users are getting the opportunity to migrate, even if they won't get a notification.

No good solution for transitioning the trate name, unfortnately, since
we can't mark `use`s as deprecated (we can, it just does nothing).

I got rid of the `into` prefix because that implies a `self` parameter
that doesn't exist.
This is part of the `App` rename.

Previously, I was concerned about not being able to deprecate

For backwards compatibility, we still expose the `IntoApp` name.
@epage epage merged commit 976f3d5 into clap-rs:master Feb 15, 2022
@epage epage deleted the derive branch February 15, 2022 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant