Tool to enforce that Cargo.toml dependencies are written in sorted order (original) (raw)
$ cargo dependencies-sorted? path/to/Cargo.toml; echo $? 0
Large projects tend to like for things to stay sorted to cut down the occurrence of merge conflicts between two developers appending to the end of the same unsorted list in parallel changes. Similar idea behind the remain crate.
The command should parse a Cargo.toml and validate that particular pieces are sorted, exiting 0 if all sorted and nonzero otherwise.
We would at least want to check:
[dependencies]
[dev-dependencies]
[build-dependencies]
[workspace.members]
[workspace.exclude]
Take a look at the documentation for Cargo.toml to see whether any other parts make sense to enforce as sorted.