mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00

Have cargo add --optional <dep> create a <dep> = "dep:<dep> feature ### What does this PR try to resolve? `cargo add --optional <dep>` would create a `<dep> = "dep:<dep>` feature iff - `rust-version` is unset or is new enough for the syntax - `dep:<dep>` doesn't already exist Fixes https://github.com/rust-lang/cargo/issues/11010 ### How should we test and review this PR? As the `dep:` syntax is only available starting with Rust 1.60. this pr maintains the previous usage convention in the earlier version. run ```shell cargo add --optional <dep> ``` with different rust-version to verify.