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