Closed
Description
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).
Reproduction:
- Add below to
[dependencies]
snapbox = { version = "0.5.8", features = ["diff", "harness", "path", "term-svg"] }
- Run
cargo add snapbox -F cmd
- See that
cmd
is not added to the front of the list
Proposed Solution
Cargo should keep features sorted alphabetically when encountered.
Notes
No response