]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
Merge pull request #3072 from matthiaskrgr/rustup
[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 #![warn(rust_2018_idioms)]
7
8 use rustc_plugin::Registry;
9
10 #[plugin_registrar]
11 pub fn plugin_registrar(reg: &mut Registry<'_>) {
12     reg.sess.lint_store.with_read_lock(|lint_store| {
13         for (lint, _, _) in lint_store.get_lint_groups() {
14             reg.sess
15                 .struct_warn(
16                     "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
17                 )
18                 .emit();
19             if lint == "clippy" {
20                 // cargo clippy run on a crate that also uses the plugin
21                 return;
22             }
23         }
24     });
25
26     let conf = clippy_lints::read_conf(reg);
27     clippy_lints::register_plugins(reg, &conf);
28 }
29
30 // only exists to let the dogfood integration test works.
31 // Don't run clippy as an executable directly
32 #[allow(dead_code)]
33 fn main() {
34     panic!("Please use the cargo-clippy executable");
35 }