]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
Remove all copyright license headers
[rust.git] / src / lib.rs
1 // error-pattern:cargo-clippy
2 #![feature(plugin_registrar)]
3 #![feature(rustc_private)]
4 #![allow(clippy::missing_docs_in_private_items)]
5 #![warn(rust_2018_idioms)]
6
7 // FIXME: switch to something more ergonomic here, once available.
8 // (currently there is no way to opt into sysroot crates w/o `extern crate`)
9 #[allow(unused_extern_crates)]
10 extern crate rustc_driver;
11 #[allow(unused_extern_crates)]
12 extern crate rustc_plugin;
13 use self::rustc_plugin::Registry;
14
15 #[plugin_registrar]
16 pub fn plugin_registrar(reg: &mut Registry<'_>) {
17     reg.sess.lint_store.with_read_lock(|lint_store| {
18         for (lint, _, _) in lint_store.get_lint_groups() {
19             reg.sess
20                 .struct_warn(
21                     "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
22                 )
23                 .emit();
24             if lint == "clippy" {
25                 // cargo clippy run on a crate that also uses the plugin
26                 return;
27             }
28         }
29     });
30
31     let conf = clippy_lints::read_conf(reg);
32     clippy_lints::register_plugins(reg, &conf);
33 }
34
35 // only exists to let the dogfood integration test works.
36 // Don't run clippy as an executable directly
37 #[allow(dead_code)]
38 fn main() {
39     panic!("Please use the cargo-clippy executable");
40 }