]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
Format code
[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
8 extern crate rustc_plugin;
9 use rustc_plugin::Registry;
10
11 extern crate clippy_lints;
12
13 #[plugin_registrar]
14 pub fn plugin_registrar(reg: &mut Registry) {
15     reg.sess.lint_store.with_read_lock(|lint_store| {
16         for (lint, _, _) in lint_store.get_lint_groups() {
17             reg.sess
18                 .struct_warn(
19                     "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
20                 )
21                 .emit();
22             if lint == "clippy" {
23                 // cargo clippy run on a crate that also uses the plugin
24                 return;
25             }
26         }
27     });
28
29     clippy_lints::register_plugins(reg);
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 }