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