Can tests be built in release mode using Cargo?

五迷三道 提交于 2019-11-28 02:53:06

问题


I'm using cargo build --release to build my project in release configuration and cargo test to build and run my tests.

However, I'd like to also build my tests in release mode; can this be done using cargo?


回答1:


cargo test --release exists, but it is slightly different than just enabling optimizations. For example, debug assertions become disabled.

You can also set opt-level in the [profile.test] section of your Cargo.toml, as Viktor Dahl suggests.



来源:https://stackoverflow.com/questions/29818084/can-tests-be-built-in-release-mode-using-cargo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!