-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
cargo add: Show features that were explicitly enabled #10681
Comments
While we shouldn't show state exclusively through formatting, we could also bold these items. |
In terms of intended use cases, this is a bit lower in the priority list for cargo-add
|
In doing this, we might also want to explicitly list a |
I'm taking my shot at this one. |
@marcospb19 Please note that this is still in discussion, so probably better sharing your idea before filing a pull request. |
@weihanglo where is that discussion taking place? If there are any concerns, I would like to know about them. I assumed that the "Proposed Solution" in my issue would be uncontroversial, because there was no feedback here suggesting otherwise. |
I don't really have a strong preference at this moment. Just need to weigh on the complexity added and the value gained. Perhaps the implementation turns out to be quite simple! @epage may have more thoughts since he commented #10681 (comment). That said, it's always worth an exploration if someone wants to deep dive into the codebase. |
@Aloso lack of feedback is not consent for change. For non-trivial Issues, we label them as For me, this is a lot of visual noise with lower value and I lean against making the change, especially when we have other information we might want to display in the future, like features that are unstable which deserve more visual attention. I'm also not really seeing the need for reporting which features were enabled explicitly |
@epage thank you for elaborating, I appreciate the feedback. |
I think the original proposal adds visual noise, but it can be improved so I'd love to discuss more what we're trying to achieve and how to best achieve that.
I use
I like to reduce the number of features and crates in order to decrease compile time and workspace folder size, so I always ask myself some questions:
I usually go to I also ask "How many (and which) dependencies did this feature add?", even though I don't want About implicit features: they obfuscate the rest of them while being mostly useless, and most people don't know about them (especially beginners), if MotivationMy main motivation is providing an easy path to achieve lower compilation times and avoid compiling/checking/linting on unused crates, but understanding how a crate structures its features (and deps) is very helpful for countless reasons. Brainstorming a solutionI don't know if that's something for But here's an uglier and arguably more useful output example:
(I'd expect the "Implicitly enabled by other feature:" section to not be present most of the time, as crates start using the new feature-dep syntax) How it looks like in the terminal: That's just an example to show how it could be done without introducing too much visual noise. Any thoughts? |
I think this is a good sign we might be using the wrong tool. |
@marcospb19 I really like your proposed plan for greater feature transparency. Understanding what |
Counter proposal for the output
Using While we'd be using color to distinguish a state to the user, this is likely a lower priority of state and seems like it'd be reasonable. This doesn't add anything more to the UI so we'd be free to distinguish other state in the future. |
The counter-proposal would certainly be an improvement over the current situation and would be welcome. That said, I would prefer some signifier in the text itself that made it easier for my students and I to figure out what Counter-counter-proposal 😀:
Would also probably want to add
If nothing else, that would mean we could copy-paste the output into issue reports here without losing anything 😄. I haven't looked at |
This comment was marked as off-topic.
This comment was marked as off-topic.
That proposal does not address the problems stated earlier. There is other relevant information being discussed in RFCs, like descriptions, unstable status, etc. What of those would be the most important to show, and why? How do we balance showing the information so the output remains usable.
Some feature information is surfaced in There is also active work on a cargo info command which could also potentially show more detailed feature information. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks much for the prompt and cogent replies! Like I say, a color change would be much better than nothing, so if that's what is offered I'll surely take it. My current workflow is often |
This matches a proposal in rust-lang/cargo#10681 for cargo-add Fixes Rustin170506#26
This matches a proposal in rust-lang/cargo#10681 for cargo-add Fixes Rustin170506#26
This matches a proposal in rust-lang/cargo#10681 for cargo-add Fixes Rustin170506#26
Problem
cargo add
can be used to enable features of an existing dependency. In that situation, it's useful to see which features were enabled explicitly, i.e. are listed in theCargo.toml
file.Proposed Solution
In the list of features, add the text
(enabled explicitly)
after explicitly enabled features:Another possibility is to only show this with the
--verbose/-v
flag, but I think it's useful enough that it can be shown always.Notes
No response
The text was updated successfully, but these errors were encountered: