This commit is contained in:
Oliver Schneider 2016-08-17 18:35:25 +02:00
parent 59c31d319a
commit 7b717d3152
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46
6 changed files with 12 additions and 18 deletions

View File

@ -9,20 +9,18 @@ use rustc_plugin::Registry;
extern crate clippy_lints;
pub use clippy_lints::*;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
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);
clippy_lints::register_plugins(reg);
}
}
// only exists to let the dogfood integration test works.
// Don't run clippy as an executable directly
#[allow(dead_code, print_stdout)]
#[allow(dead_code)]
fn main() {
panic!("Please use the cargo-clippy executable");
}

View File

@ -1,7 +1,6 @@
#[allow(plugin_as_library)]
extern crate clippy;
extern crate clippy_lints;
use clippy::utils::{camel_case_from, camel_case_until};
use clippy_lints::utils::{camel_case_from, camel_case_until};
#[test]
fn from_full() {

View File

@ -6,7 +6,7 @@ use std::env::{set_var, var};
fn run_mode(dir: &'static str, mode: &'static str) {
let mut config = compiletest::default_config();
let cfg_mode = mode.parse().ok().expect("Invalid mode");
let cfg_mode = mode.parse().expect("Invalid mode");
config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps".to_owned());
if let Ok(name) = var::<&str>("TESTNAME") {
let s: String = name.to_owned();

View File

@ -1,13 +1,12 @@
#![allow(plugin_as_library)]
#![feature(rustc_private)]
extern crate clippy;
extern crate clippy_lints;
extern crate rustc;
extern crate rustc_const_eval;
extern crate rustc_const_math;
extern crate syntax;
use clippy::consts::{constant_simple, Constant, FloatWidth};
use clippy_lints::consts::{constant_simple, Constant, FloatWidth};
use rustc_const_math::ConstInt;
use rustc::hir::*;
use syntax::ast::{LitIntType, LitKind, StrStyle};

View File

@ -1,16 +1,15 @@
#![allow(plugin_as_library)]
#![feature(rustc_private)]
extern crate clippy;
extern crate clippy_lints;
extern crate syntax;
#[test]
fn test_overlapping() {
use clippy::matches::overlapping;
use clippy_lints::matches::overlapping;
use syntax::codemap::DUMMY_SP;
let sp = |s, e| {
clippy::matches::SpannedRange {
clippy_lints::matches::SpannedRange {
span: DUMMY_SP,
node: (s, e),
}

View File

@ -1,8 +1,7 @@
/// test the multiline-trim function
#[allow(plugin_as_library)]
extern crate clippy;
extern crate clippy_lints;
use clippy::utils::trim_multiline;
use clippy_lints::utils::trim_multiline;
#[test]
fn test_single_line() {