Why dev-dependencies cannot be optional?

Viewed 754

As it's clearly mentioned here, dev-dependencies cannot be optional. What is the underlying reason for that?

This is an example of where the optional dev-dependency could be useful and important: Suppose you have a package A that needs a package B for the testing purpose. However, when you test the package A, in some cases, you specify a particular feature: cargo test --package A --features "F1" It would then seem to be legitimate that you have the option of specifying the dev-dependency to B differently when the feature "F1" is selected. But if your dev-dependency is already pulled in (non-optionally) you seem to have no control over that!

0 Answers
Related