From b523d35d41c51bff255fd038b0d6acb695e42060 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 15 Jul 2019 07:35:02 +0200 Subject: [PATCH] Deny warnings in CI --- Cargo.toml | 1 + ci/base-tests.sh | 4 ++-- clippy_lints/src/lib.rs | 1 + src/driver.rs | 1 + src/main.rs | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f68251adb5e..8c70bb18939 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 c5d3eb3c902..71f3d38309a 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 0d2c9e6b987..369a736aa64 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 e6b04bf0cfd..cd358ff35cb 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 e0b2bcc7266..8f9afb95337 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.