rust-clippy/src/lib.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

// error-pattern:cargo-clippy
2016-06-06 15:09:51 +00:00
#![feature(plugin_registrar)]
#![feature(rust_2018_preview)]
2016-06-06 15:09:51 +00:00
#![feature(rustc_private)]
#![feature(macro_vis_matcher)]
2016-06-06 15:09:51 +00:00
#![allow(unknown_lints)]
#![allow(missing_docs_in_private_items)]
2016-03-23 11:19:13 +00:00
extern crate rustc_plugin;
use rustc_plugin::Registry;
2014-11-19 08:57:34 +00:00
extern crate clippy_lints;
2014-11-19 08:57:34 +00:00
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.sess.lint_store.with_read_lock(|lint_store| {
for (lint, _, _) in lint_store.get_lint_groups() {
reg.sess
2018-05-22 08:21:42 +00:00
.struct_warn(
"the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
)
.emit();
if lint == "clippy" {
// cargo clippy run on a crate that also uses the plugin
return;
}
2016-12-19 19:22:38 +00:00
}
});
2016-12-19 19:22:38 +00:00
clippy_lints::register_plugins(reg);
}
2015-08-21 15:11:34 +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)]
fn main() {
panic!("Please use the cargo-clippy executable");
2014-12-10 21:34:58 +00:00
}