about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxFrednet <xFrednet@gmail.com>2021-03-12 21:52:01 +0100
committerxFrednet <xFrednet@gmail.com>2021-05-05 18:38:26 +0200
commitc1fa1102d484b74cb7bc425994fa4246dd690ad3 (patch)
tree419f1ea2e9e10de3c5b57f558ed4f8bb39ad2d8a
parent4fc960301bcd4370bfc2238415c7ba3d2d8f9312 (diff)
downloadrust-c1fa1102d484b74cb7bc425994fa4246dd690ad3.tar.gz
rust-c1fa1102d484b74cb7bc425994fa4246dd690ad3.zip
ENABLE_METADATA_COLLECTION env-value to disable default metadata collection
-rw-r--r--clippy_lints/src/lib.rs6
-rw-r--r--clippy_lints/src/utils/internal_lints/metadata_collector.rs18
-rw-r--r--tests/dogfood.rs2
3 files changed, 7 insertions, 19 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 7668d4dd0b1..1a74f641554 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -1005,7 +1005,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
         store.register_late_pass(|| box utils::internal_lints::OuterExpnDataPass);
     }
     #[cfg(feature = "metadata-collector-lint")]
-    store.register_late_pass(|| box utils::internal_lints::metadata_collector::MetadataCollector::default());
+    {
+        if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
+            store.register_late_pass(|| box utils::internal_lints::metadata_collector::MetadataCollector::default());
+        }
+    }
 
     store.register_late_pass(|| box utils::author::Author);
     store.register_late_pass(|| box await_holding_invalid::AwaitHolding);
diff --git a/clippy_lints/src/utils/internal_lints/metadata_collector.rs b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
index 37e90bf8686..07abae31386 100644
--- a/clippy_lints/src/utils/internal_lints/metadata_collector.rs
+++ b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
@@ -148,24 +148,6 @@ struct LintMetadata {
     applicability: Option<ApplicabilityInfo>,
 }
 
-// impl Ord for LintMetadata {
-//     fn cmp(&self, other: &Self) -> Ordering {
-//         self.id.cmp(&other.id)
-//     }
-// }
-//
-// impl PartialOrd for LintMetadata {
-//     fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-//         Some(self.cmp(other))
-//     }
-// }
-//
-// impl PartialEq for LintMetadata {
-//     fn eq(&self, other: &Self) -> bool {
-//         self.id == other.id
-//     }
-// }
-
 impl LintMetadata {
     fn new(id: String, id_span: SerializableSpan, group: String, docs: String) -> Self {
         Self {
diff --git a/tests/dogfood.rs b/tests/dogfood.rs
index 604968ad8b0..6524fd4706c 100644
--- a/tests/dogfood.rs
+++ b/tests/dogfood.rs
@@ -22,12 +22,14 @@ fn dogfood_clippy() {
         return;
     }
     let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+    let enable_metadata_collection = std::env::var("ENABLE_METADATA_COLLECTION").unwrap_or_else(|_| "0".to_string());
 
     let mut command = Command::new(&*CLIPPY_PATH);
     command
         .current_dir(root_dir)
         .env("CLIPPY_DOGFOOD", "1")
         .env("CARGO_INCREMENTAL", "0")
+        .env("ENABLE_METADATA_COLLECTION", &enable_metadata_collection)
         .arg("clippy")
         .arg("--all-targets")
         .arg("--all-features")