]> git.lizzy.rs Git - rust.git/blobdiff - src/lib.rs
Merge pull request #3085 from mikerite/revert-98dbce
[rust.git] / src / lib.rs
index 9672f16eddc2829c4cf79bee425d2e131ed03563..a7167ac10de4f4a599c28adef05934570d96e056 100644 (file)
@@ -1,24 +1,31 @@
 // error-pattern:cargo-clippy
 #![feature(plugin_registrar)]
 #![feature(rustc_private)]
+#![feature(tool_lints)]
 #![allow(unknown_lints)]
-#![allow(missing_docs_in_private_items)]
+#![allow(clippy::missing_docs_in_private_items)]
+#![warn(rust_2018_idioms)]
 
-extern crate rustc_plugin;
 use rustc_plugin::Registry;
 
-extern crate clippy_lints;
-
 #[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
-    if let Ok(lint_store) = reg.sess.lint_store.try_borrow() {
-        if lint_store.get_lint_groups().iter().any(|&(s, _, _)| s == "clippy") {
-            reg.sess.struct_warn("running cargo clippy on a crate that also imports the clippy plugin").emit();
-            return;
+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;
+            }
         }
-    }
+    });
 
-    clippy_lints::register_plugins(reg);
+    let conf = clippy_lints::read_conf(reg);
+    clippy_lints::register_plugins(reg, &conf);
 }
 
 // only exists to let the dogfood integration test works.