cargo add
should maintain sorting of features
#13578
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-add
S-accepted
Status: Issue or feature is accepted, and has a team member available to help mentor or review
Problem
When you run
cargo add <package> -F <feature>
when the dependency already has features that are sorted alphabetically, the new features get added to the back instead of in alphabetical order. This is unexpected and different from what happens when you add a dependency to a sorted dependency list, where it respects being sorted (cargo code).Example
Reproduction:
[dependencies]
cargo add snapbox -F cmd
cmd
is not added to the front of the listProposed Solution
Cargo should keep features sorted alphabetically when encountered.
Notes
No response
The text was updated successfully, but these errors were encountered: