How to define test-only dependencies?

前端 未结 1 1267
我寻月下人不归
我寻月下人不归 2020-12-28 11:27

I have a Rust library that implements a lint plugin. I want to include compiletest, but not require it outside of testing. What is the correct way to specify th

相关标签:
1条回答
  • 2020-12-28 11:56

    Yes. Use dev-dependencies. From the Cargo docs:

    You can add a [dev-dependencies] section to your Cargo.toml whose format is equivalent to [dependencies]:

    [dev-dependencies]
    tempdir = "0.3"
    

    Dev-dependencies are not used when compiling a package for building, but are used for compiling tests, examples, and benchmarks.

    0 讨论(0)
提交回复
热议问题