]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
Remove now-useless `allow(unknown_lints)`
[rust.git] / src / lib.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10
11 // error-pattern:cargo-clippy
12 #![feature(plugin_registrar)]
13 #![feature(rustc_private)]
14
15 #![allow(clippy::missing_docs_in_private_items)]
16 #![warn(rust_2018_idioms)]
17
18 // FIXME: switch to something more ergonomic here, once available.
19 // (currently there is no way to opt into sysroot crates w/o `extern crate`)
20 #[allow(unused_extern_crates)]
21 extern crate rustc_plugin;
22 use self::rustc_plugin::Registry;
23
24 #[plugin_registrar]
25 pub fn plugin_registrar(reg: &mut Registry<'_>) {
26     reg.sess.lint_store.with_read_lock(|lint_store| {
27         for (lint, _, _) in lint_store.get_lint_groups() {
28             reg.sess
29                 .struct_warn(
30                     "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
31                 )
32                 .emit();
33             if lint == "clippy" {
34                 // cargo clippy run on a crate that also uses the plugin
35                 return;
36             }
37         }
38     });
39
40     let conf = clippy_lints::read_conf(reg);
41     clippy_lints::register_plugins(reg, &conf);
42 }
43
44 // only exists to let the dogfood integration test works.
45 // Don't run clippy as an executable directly
46 #[allow(dead_code)]
47 fn main() {
48     panic!("Please use the cargo-clippy executable");
49 }