1
Fork 0
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; extern crate clippy_lints;
pub use clippy_lints::*;
#[plugin_registrar] #[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) { 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") { 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(); reg.sess.struct_warn("running cargo clippy on a crate that also imports the clippy plugin").emit();
} else { } else {
register_plugins(reg); clippy_lints::register_plugins(reg);
} }
} }
// only exists to let the dogfood integration test works. // only exists to let the dogfood integration test works.
// Don't run clippy as an executable directly // Don't run clippy as an executable directly
#[allow(dead_code, print_stdout)] #[allow(dead_code)]
fn main() { fn main() {
panic!("Please use the cargo-clippy executable"); panic!("Please use the cargo-clippy executable");
} }

View file

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

View file

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

View file

@ -1,13 +1,12 @@
#![allow(plugin_as_library)]
#![feature(rustc_private)] #![feature(rustc_private)]
extern crate clippy; extern crate clippy_lints;
extern crate rustc; extern crate rustc;
extern crate rustc_const_eval; extern crate rustc_const_eval;
extern crate rustc_const_math; extern crate rustc_const_math;
extern crate syntax; 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_const_math::ConstInt;
use rustc::hir::*; use rustc::hir::*;
use syntax::ast::{LitIntType, LitKind, StrStyle}; use syntax::ast::{LitIntType, LitKind, StrStyle};

View file

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

View file

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