I found that when I had an optional dependency in a crate and a feature that depended on it with the same name, the expanded crate would not create explicit dependencies on the dep:foo optional features, and then Cargo would complain that dep:foo was unused. For instance:
# Original my_crate Cargo.toml
[features]
foo = ["dep:foo", "other/foo"]
[dependencies]
foo = { version = "1.0.0", optional = true }
would give rise to
error: failed to parse manifest at `/.../macrotest000/Cargo.toml`
Caused by:
optional dependency `foo` is not included in any feature
Make sure that `dep:foo` is included in one of features in the [features] table.
I found that when I had an optional dependency in a crate and a feature that depended on it with the same name, the expanded crate would not create explicit dependencies on the
dep:foo
optional features, and then Cargo would complain thatdep:foo
was unused. For instance:would give rise to
because the generated
Cargo.toml
would look likeand the automatic
foo
feature would not be created. This PR preserves alldep:…
features when creating the expandedCargo.toml
: