Description
Often you need to specify the crate version in several places:
- Cargo.toml
- CLI config file (to support --version)
- Within the code itself
Additionally, you sometimes have several crates within the same repository, whose versions you want to keep in lock-step. The crate version must then additionally be specified:
- In the sub-crate's Cargo.toml
- Within the [dependencies] section of the parent Cargo.toml
For more complex projects, it's easy to imagine that there's other information which may be desirable, eg. git commit hash, build date, and additional configuration options (think rust's channel system).
All in all, this can make publishing a new version somewhat tedious and error-prone. Honestly I don't know what a good and general solution is that covers all of these cases.
Currently the only way I can see of doing it would be to turn most of the project into template files which are passed through a pre-processor by the build script, but this is extremely intrusive, and wouldn't work for redundancy within Cargo.toml itself.