diff --git a/Cargo.toml b/Cargo.toml index f68251adb5eab..8c70bb1893972 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,4 +61,5 @@ rustc-workspace-hack = "1.0.0" rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"} [features] +deny-warnings = [] debugging = [] diff --git a/ci/base-tests.sh b/ci/base-tests.sh index a53a0ea52be62..d91d553147cd1 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -7,8 +7,8 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then remark -f *.md -f doc/*.md > /dev/null fi # build clippy in debug mode and run tests -cargo build --features debugging -cargo test --features debugging +cargo build --features "debugging deny-warnings" +cargo test --features "debugging deny-warnings" # for faster build, share target dir between subcrates export CARGO_TARGET_DIR=`pwd`/target/ (cd clippy_lints && cargo test) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 0d2c9e6b98704..369a736aa644c 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -9,6 +9,7 @@ #![recursion_limit = "512"] #![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)] #![deny(rustc::internal)] +#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![feature(crate_visibility_modifier)] #![feature(concat_idents)] diff --git a/src/driver.rs b/src/driver.rs index 545c43f9a45fe..146e3fe2d08f0 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -1,3 +1,4 @@ +#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![feature(rustc_private)] // FIXME: switch to something more ergonomic here, once available. diff --git a/src/main.rs b/src/main.rs index e0b2bcc726645..8f9afb95337de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +#![cfg_attr(feature = "deny-warnings", deny(warnings))] + use rustc_tools_util::*; const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catch common mistakes and improve your Rust code.