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

Add --all-features to cargo add #13936

Open
SteveLauC opened this issue May 20, 2024 · 3 comments
Open

Add --all-features to cargo add #13936

SteveLauC opened this issue May 20, 2024 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@SteveLauC
Copy link

SteveLauC commented May 20, 2024

Problem

Sometimes, I want to add a crate and blindly enable all the features. For example, Nix puts almost all the interfaces behind at least 1 feature gate, to use an interface, one has to enable the corresponding feature, which is good for reducing the compilation time.

But there are cases where I don't want to bother with that, it is a pain to open the doc, and figure out the feature name used by the interface I want to use and enable it.

If cargo add has a --all-features flag, then I can just enable all the features with it.

Proposed Solution

If would be nice if --all-features could be supported by cargo add, i.e., add the dependencies and enable all their features.

One alternative way to solve the issue is to provide a full feature in Nix, like tokio does, so that I can:

$ cargo add nix --features full

Notes

No response

@SteveLauC SteveLauC added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels May 20, 2024
@heisen-li
Copy link
Contributor

@rustbot label +Command-add

@weihanglo
Copy link
Member

Just check the original cargo-edit before it got moved into cargo. It didn't have the --all-features flag as well, so I guess we just never though of that.

Would you mind sharing more on the use cases you have? It is helpful for us to think through them and might come up other creative alternatives.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels May 20, 2024
@SteveLauC
Copy link
Author

Hi, thanks for the reply!

Would you mind sharing more on the use cases you have?

Currently, the only usage I have is the one described here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants