This is an old thread, but it's still useful today. Here's a step-by-step guide:
If you want to fail the build when there are warnings, but only in CI, add this to your Cargo.toml:
[features]
# Treat warnings as a build error.
strict = []
Now add to the root of your crate (lib.rs
or main.rs
):
#![cfg_attr(feature = "strict", deny(warnings))]
You can then compile on Travis with the following command:
$ cargo build --features "strict"
and it will fail if there are any warnings.