首页 > 解决方案 > 为什么开发依赖不能是可选的?

问题描述

正如这里明确提到的,开发依赖项不能是可选的。其根本原因是什么?

这是可选的开发依赖项可能有用且重要的示例:假设您有一个包 A 需要一个包 B 用于测试目的。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. 但是,如果您的开发依赖关系已经被引入(非可选),您似乎无法控制它!

标签: rustrust-cargo

解决方案


推荐阅读