From 397561f5ca96ed86a125eaf287c0f2be75b91d83 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Mon, 3 Sep 2018 14:42:07 +0200 Subject: [PATCH 1/2] Use clippy_lints::read_conf This should crawl the FS and use the default Clippy config file (e.g. clippy.toml) --- src/build/rustc.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/build/rustc.rs b/src/build/rustc.rs index 4ea387fdee8..984b80b3696 100644 --- a/src/build/rustc.rs +++ b/src/build/rustc.rs @@ -29,7 +29,6 @@ use crate::build::{BufWriter, BuildResult}; use crate::config::{ClippyPreference, Config}; use std::collections::HashMap; -use std::default::Default; use std::ffi::OsString; use std::io; use std::path::{Path, PathBuf}; @@ -161,9 +160,8 @@ fn clippy_after_parse_callback(state: &mut ::rustc_driver::driver::CompileState< ); registry.args_hidden = Some(Vec::new()); - // TODO handle clippy toml config - let empty_clippy_conf = clippy_lints::Conf::default(); - clippy_lints::register_plugins(&mut registry, &empty_clippy_conf); + let conf = clippy_lints::read_conf(®istry); + clippy_lints::register_plugins(&mut registry, &conf); let Registry { early_lint_passes, From cf6358a00540a83dcc6e8c243f3306ccdbb9c354 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 4 Sep 2018 14:46:47 +0200 Subject: [PATCH 2/2] Fix Clippy opt-in with tool lints It seems that rustc doesn't handle `-Aclippy::all` and needs for the tool lint to be separated (`-A clippy::all`) --- src/build/rustc.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/build/rustc.rs b/src/build/rustc.rs index 984b80b3696..f15507ba1b6 100644 --- a/src/build/rustc.rs +++ b/src/build/rustc.rs @@ -70,8 +70,9 @@ crate fn rustc( let mut clippy_args = vec!["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]; if clippy_pref == ClippyPreference::OptIn { - // `OptIn`: allow clippy require `#![warn(clippy)]` override in each workspace crate - clippy_args.push("-Aclippy".to_owned()); + // `OptIn`: Require explicit `#![warn(clippy::all)]` annotation in each workspace crate + clippy_args.push("-A".to_owned()); + clippy_args.push("clippy::all".to_owned()); } args.iter()