cargo
cargo copied to clipboard
Feature named for private dependency
What it does
Identify any feature name that matches a dependency that it activates
This is easy to accidentally do from
- Implicit features
-
cargo add --optionalcreating the explicit feature for you
Advantage
This is a semver hazard in case the dependency is swapped out for a different one
Drawbacks
For a generic enough dependency name, this could cause an annoyance
Example
[features]
strsim = ["dep:strsim"]
[dependencies]
strsim = { version = "*', optional = true }
Could be written as:
[features]
suggestions = ["dep:strsim"]
[dependencies]
strsim = { version = "*', optional = true }