2016-05-24 16:25:25 +00:00
|
|
|
// error-pattern:cargo-clippy
|
2016-06-06 15:09:51 +00:00
|
|
|
#![feature(plugin_registrar)]
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
#![allow(unknown_lints)]
|
2016-08-23 16:09:37 +00:00
|
|
|
#![allow(missing_docs_in_private_items)]
|
2016-03-23 11:19:13 +00:00
|
|
|
|
2015-11-27 13:47:00 +00:00
|
|
|
extern crate rustc_plugin;
|
|
|
|
use rustc_plugin::Registry;
|
2014-11-19 08:57:34 +00:00
|
|
|
|
2016-05-24 16:25:25 +00:00
|
|
|
extern crate clippy_lints;
|
|
|
|
|
2014-11-19 08:57:34 +00:00
|
|
|
#[plugin_registrar]
|
|
|
|
pub fn plugin_registrar(reg: &mut Registry) {
|
2016-12-19 19:22:38 +00:00
|
|
|
if let Ok(lint_store) = reg.sess.lint_store.try_borrow() {
|
2017-04-12 09:06:32 +00:00
|
|
|
if lint_store
|
|
|
|
.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();
|
2016-12-19 19:22:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-08-17 15:43:49 +00:00
|
|
|
}
|
2016-12-19 19:22:38 +00:00
|
|
|
|
|
|
|
clippy_lints::register_plugins(reg);
|
2016-05-24 16:25:25 +00:00
|
|
|
}
|
2015-08-21 15:11:34 +00:00
|
|
|
|
2016-05-24 16:25:25 +00:00
|
|
|
// only exists to let the dogfood integration test works.
|
|
|
|
// Don't run clippy as an executable directly
|
2016-08-17 16:35:25 +00:00
|
|
|
#[allow(dead_code)]
|
2016-05-24 16:25:25 +00:00
|
|
|
fn main() {
|
|
|
|
panic!("Please use the cargo-clippy executable");
|
2014-12-10 21:34:58 +00:00
|
|
|
}
|