-
Notifications
You must be signed in to change notification settings - Fork 160
Closed
Description
Recently, the crate learned how to process Cargo.toml
files with dotted keys (#400).
It would be great if cargo add could keep the formatting in the Cargo.toml
consistent, meaning that if it uses dotted keys, new entries should follow the format and not use inline tables.
# Before
serde_json.version = "1.0.68"
# After: cargo add serde --features=derive
serde = { version = "1.0.130", features = ["derive"] }
serde_json.version = "1.0.68"
# How it should look like
serde.features = ["derive"]
serde.version = "1.0.130"
serde_json.version = "1.0.68"
"cargo add" already tries to keep entries sorted, if the Cargo.toml
was sorted (#401). There is also an open issue about keeping the string style consistent (#217). Using the dotted keys syntax feels similar to those two issues.
BartMassey