ENABLE_METADATA_COLLECTION env-value to disable default metadata collection

This commit is contained in:
xFrednet 2021-03-12 21:52:01 +01:00
parent 4fc960301b
commit c1fa1102d4
3 changed files with 7 additions and 19 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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")