plugin mode still needs to work

This commit is contained in:
Oliver Schneider 2016-08-17 18:26:58 +02:00
parent e3723cb938
commit 59c31d319a
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -2,6 +2,7 @@
#![feature(plugin_registrar)]
#![feature(rustc_private)]
#![allow(unknown_lints)]
#![feature(borrow_state)]
extern crate rustc_plugin;
use rustc_plugin::Registry;
@ -12,7 +13,7 @@ pub use clippy_lints::*;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
if reg.sess.lint_store.borrow().get_lint_groups().iter().any(|&(s, _, _)| s == "clippy") {
if reg.sess.lint_store.borrow_state() == std::cell::BorrowState::Unused && reg.sess.lint_store.borrow().get_lint_groups().iter().any(|&(s, _, _)| s == "clippy") {
reg.sess.struct_warn("running cargo clippy on a crate that also imports the clippy plugin").emit();
} else {
register_plugins(reg);