Description
Problem
While initializing a new project using cargo init
, a comment is automatically inserted at the top of the Cargo.toml
file:
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Although this is undoubtedly a helpful resource for newcomers and those unfamiliar with Cargo, for seasoned Rust developers this is not necessary and it adds an additional manual step of removing it every time a new project is initialized. Especially for developers working with automated systems or setting up multiple projects, the comment can be slightly annoying.
Proposed Solution
I propose adding an option to the cargo init
command, let's say --no-comment
, that when used will not include the standard commented URL at the top of the Cargo.toml
file. The command would look like this:
cargo init --no-comment
By providing this option, developers have the flexibility to opt-in or opt-out of having the comment in their Cargo.toml
file as per their requirements or preferences. It wouldn't impact beginners as the default behavior would still be to include the comment, unless explicitly opted out using the --no-comment
flag.
Notes
I believe this minor enhancement would improve the developer experience by reducing manual interventions, particularly for those creating a large number of Rust projects or using automated tools to initialize Rust projects. This change should not affect the functionality of cargo init
, and it would be backward compatible since it just introduces a new optional flag.
Please consider this request and let me know if you need any additional information. I am willing to try to implement it. Thanks!