]> git.lizzy.rs Git - rust.git/blobdiff - src/lib.rs
deps: bump toml from 0.4 to 0.5
[rust.git] / src / lib.rs
index f9a6588e9043c51b9f387c79f67d356a1f231ae8..86174a6b316fc942663ef7122eb71b74a15f7bcd 100644 (file)
@@ -1,63 +1,39 @@
 // error-pattern:cargo-clippy
-#![feature(type_macros)]
-#![feature(plugin_registrar, box_syntax)]
-#![feature(rustc_private, collections)]
-#![feature(custom_attribute)]
-#![feature(slice_patterns)]
-#![feature(question_mark)]
-#![feature(stmt_expr_attributes)]
-#![allow(indexing_slicing, shadow_reuse, unknown_lints)]
-
-#[macro_use]
-extern crate syntax;
-#[macro_use]
-extern crate rustc;
-
-extern crate toml;
-
-// Only for the compile time checking of paths
-extern crate core;
-extern crate collections;
-
-// for unicode nfc normalization
-extern crate unicode_normalization;
-
-// for semver check in attrs.rs
-extern crate semver;
-
-// for regex checking
-extern crate regex_syntax;
-
-// for finding minimal boolean expressions
-extern crate quine_mc_cluskey;
-
+#![feature(plugin_registrar)]
+#![feature(rustc_private)]
+#![warn(rust_2018_idioms)]
+
+// FIXME: switch to something more ergonomic here, once available.
+// (Currently there is no way to opt into sysroot crates without `extern crate`.)
+#[allow(unused_extern_crates)]
+extern crate rustc_driver;
+#[allow(unused_extern_crates)]
 extern crate rustc_plugin;
-extern crate rustc_const_eval;
-extern crate rustc_const_math;
-use rustc_plugin::Registry;
-
-extern crate clippy_lints;
-
-pub use clippy_lints::*;
-
-macro_rules! declare_restriction_lint {
-    { pub $name:tt, $description:tt } => {
-        declare_lint! { pub $name, Allow, $description }
-    };
-}
-
-mod reexport {
-    pub use syntax::ast::{Name, NodeId};
-}
+use self::rustc_plugin::Registry;
 
 #[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
-    register_plugins(reg);
+pub fn plugin_registrar(reg: &mut Registry<'_>) {
+    reg.sess.lint_store.with_read_lock(|lint_store| {
+        for (lint, _, _) in lint_store.get_lint_groups() {
+            reg.sess
+                .struct_warn(
+                    "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
+                )
+                .emit();
+            if lint == "clippy" {
+                // cargo clippy run on a crate that also uses the plugin
+                return;
+            }
+        }
+    });
+
+    let conf = clippy_lints::read_conf(reg);
+    clippy_lints::register_plugins(reg, &conf);
 }
 
 // only exists to let the dogfood integration test works.
 // Don't run clippy as an executable directly
-#[allow(dead_code, print_stdout)]
+#[allow(dead_code)]
 fn main() {
     panic!("Please use the cargo-clippy executable");
 }