]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
Fix a couple warnings
[rust.git] / src / lib.rs
1 // error-pattern:cargo-clippy
2 #![feature(plugin_registrar)]
3 #![feature(rustc_private)]
4 #![allow(unknown_lints)]
5 #![allow(missing_docs_in_private_items)]
6
7 extern crate rustc_plugin;
8 use rustc_plugin::Registry;
9
10 extern crate clippy_lints;
11
12 #[plugin_registrar]
13 pub fn plugin_registrar(reg: &mut Registry) {
14     if let Ok(lint_store) = reg.sess.lint_store.try_borrow() {
15         if lint_store.get_lint_groups().iter().any(|&(s, _, _)| s == "clippy") {
16             reg.sess.struct_warn("running cargo clippy on a crate that also imports the clippy plugin").emit();
17             return;
18         }
19     }
20
21     clippy_lints::register_plugins(reg);
22 }
23
24 // only exists to let the dogfood integration test works.
25 // Don't run clippy as an executable directly
26 #[allow(dead_code)]
27 fn main() {
28     panic!("Please use the cargo-clippy executable");
29 }