1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
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.
11 // error-pattern:cargo-clippy
12 #![feature(plugin_registrar)]
13 #![feature(rustc_private)]
14 #![feature(tool_lints)]
15 #![allow(unknown_lints)]
16 #![allow(clippy::missing_docs_in_private_items)]
17 #![warn(rust_2018_idioms)]
19 // FIXME: switch to something more ergonomic here, once available.
20 // (currently there is no way to opt into sysroot crates w/o `extern crate`)
21 #[allow(unused_extern_crates)]
22 extern crate rustc_plugin;
23 use self::rustc_plugin::Registry;
26 pub fn plugin_registrar(reg: &mut Registry<'_>) {
27 reg.sess.lint_store.with_read_lock(|lint_store| {
28 for (lint, _, _) in lint_store.get_lint_groups() {
31 "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
35 // cargo clippy run on a crate that also uses the plugin
41 let conf = clippy_lints::read_conf(reg);
42 clippy_lints::register_plugins(reg, &conf);
45 // only exists to let the dogfood integration test works.
46 // Don't run clippy as an executable directly
49 panic!("Please use the cargo-clippy executable");