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

Disable adding a feature when using cargo-add --optional #13430

Closed
passcod opened this issue Feb 11, 2024 · 2 comments
Closed

Disable adding a feature when using cargo-add --optional #13430

passcod opened this issue Feb 11, 2024 · 2 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-triage Status: This issue is waiting on initial triage.

Comments

@passcod
Copy link

passcod commented Feb 11, 2024

Problem

With #13071, cargo add started creating explicit features for new optional deps. While I understand the reasoning, this is frustrating to have to keep remembering to delete that line when I actively want to use the newer behaviour that adding optional dependencies doesn't create features.

Proposed Solution

Some kind of opt-in switch or heuristic that will let me disable this behaviour.

Notes

No response

@passcod passcod 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 Feb 11, 2024
@epage
Copy link
Contributor

epage commented Feb 12, 2024

In addition to

  • Pedagogical purposes
  • Jump starting people who want to make the dependency a feature

We did this because it will be an error to do anything else in the next edition, see rust-lang/rfcs#3491

Any switch will be short-lived. Since this use case has the user editing the file either way, I don't think a switch would have been worth it.

However, like #13411, I wonder if we should add a Status message saying that we added the feature. This way users are less likely to miss that it was done.

@passcod
Copy link
Author

passcod commented Feb 15, 2024

Your proposed/PR addition seems a fine resolution, I'm gonna go ahead and close this ticket while that lands.

@passcod passcod closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2024
bors added a commit that referenced this issue Feb 15, 2024
fix(add): Ensure users know a feature is being created

Inspired by #13430 and #13411
epage added a commit to epage/cargo that referenced this issue Feb 15, 2024
bors added a commit that referenced this issue Feb 15, 2024
fix(add): Ensure users know a feature is being created

Inspired by #13430 and #13411
stupendoussuperpowers pushed a commit to stupendoussuperpowers/cargo that referenced this issue Feb 28, 2024
charmitro pushed a commit to charmitro/cargo that referenced this issue Sep 13, 2024
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-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants