2016-05-24 18:25:25 +02:00
|
|
|
// error-pattern:cargo-clippy
|
2016-06-06 17:09:51 +02:00
|
|
|
#![feature(plugin_registrar)]
|
2018-05-30 10:05:06 +02:00
|
|
|
#![feature(rust_2018_preview)]
|
2016-06-06 17:09:51 +02:00
|
|
|
#![feature(rustc_private)]
|
2017-10-31 02:21:23 +01:00
|
|
|
#![feature(macro_vis_matcher)]
|
2016-06-06 17:09:51 +02:00
|
|
|
#![allow(unknown_lints)]
|
2016-08-23 18:09:37 +02:00
|
|
|
#![allow(missing_docs_in_private_items)]
|
2016-03-23 12:19:13 +01:00
|
|
|
|
2015-11-27 14:47:00 +01:00
|
|
|
extern crate rustc_plugin;
|
|
|
|
use rustc_plugin::Registry;
|
2014-11-19 09:57:34 +01:00
|
|
|
|
2016-05-24 18:25:25 +02:00
|
|
|
extern crate clippy_lints;
|
|
|
|
|
2014-11-19 09:57:34 +01:00
|
|
|
#[plugin_registrar]
|
|
|
|
pub fn plugin_registrar(reg: &mut Registry) {
|
2018-04-18 20:25:43 +02:00
|
|
|
reg.sess.lint_store.with_read_lock(|lint_store| {
|
2017-08-09 09:59:38 +02:00
|
|
|
for (lint, _, _) in lint_store.get_lint_groups() {
|
2018-05-11 13:20:39 +02:00
|
|
|
reg.sess
|
2018-05-22 10:21:42 +02:00
|
|
|
.struct_warn(
|
|
|
|
"the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
|
|
|
|
)
|
2018-05-11 13:20:39 +02:00
|
|
|
.emit();
|
2017-08-09 09:59:38 +02:00
|
|
|
if lint == "clippy" {
|
2018-05-11 13:20:39 +02:00
|
|
|
// cargo clippy run on a crate that also uses the plugin
|
2017-08-09 09:59:38 +02:00
|
|
|
return;
|
|
|
|
}
|
2016-12-19 20:22:38 +01:00
|
|
|
}
|
2018-04-18 20:25:43 +02:00
|
|
|
});
|
2016-12-19 20:22:38 +01:00
|
|
|
|
|
|
|
clippy_lints::register_plugins(reg);
|
2016-05-24 18:25:25 +02:00
|
|
|
}
|
2015-08-21 17:11:34 +02:00
|
|
|
|
2016-05-24 18:25:25 +02:00
|
|
|
// only exists to let the dogfood integration test works.
|
|
|
|
// Don't run clippy as an executable directly
|
2016-08-17 18:35:25 +02:00
|
|
|
#[allow(dead_code)]
|
2016-05-24 18:25:25 +02:00
|
|
|
fn main() {
|
|
|
|
panic!("Please use the cargo-clippy executable");
|
2014-12-10 22:34:58 +01:00
|
|
|
}
|