mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Auto merge of #13384 - Alexendoo:remove-old-collect-metadata, r=llogiq
Remove unused `collect_metadata` function Leftover from #13221 changelog: none
This commit is contained in:
commit
0e1ded0f8d
1 changed files with 1 additions and 48 deletions
|
@ -6,11 +6,9 @@
|
||||||
#![warn(rust_2018_idioms, unused_lifetimes)]
|
#![warn(rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use std::fs::File;
|
|
||||||
use std::io::{self, IsTerminal};
|
use std::io::{self, IsTerminal};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::SystemTime;
|
|
||||||
use test_utils::IS_RUSTC_TEST_SUITE;
|
use test_utils::IS_RUSTC_TEST_SUITE;
|
||||||
use ui_test::Args;
|
use ui_test::Args;
|
||||||
|
|
||||||
|
@ -28,13 +26,9 @@ fn main() {
|
||||||
println!("dogfood: test");
|
println!("dogfood: test");
|
||||||
}
|
}
|
||||||
} else if !args.skip.iter().any(|arg| arg == "dogfood") {
|
} else if !args.skip.iter().any(|arg| arg == "dogfood") {
|
||||||
if args.filters.iter().any(|arg| arg == "collect_metadata") {
|
|
||||||
collect_metadata();
|
|
||||||
} else {
|
|
||||||
dogfood();
|
dogfood();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn dogfood() {
|
fn dogfood() {
|
||||||
let mut failed_packages = Vec::new();
|
let mut failed_packages = Vec::new();
|
||||||
|
@ -61,47 +55,6 @@ fn dogfood() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_metadata() {
|
|
||||||
assert!(cfg!(feature = "internal"));
|
|
||||||
|
|
||||||
// Setup for validation
|
|
||||||
let metadata_output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("util/gh-pages/lints.json");
|
|
||||||
let start_time = SystemTime::now();
|
|
||||||
|
|
||||||
// Run collection as is
|
|
||||||
std::env::set_var("ENABLE_METADATA_COLLECTION", "1");
|
|
||||||
assert!(run_clippy_for_package(
|
|
||||||
"clippy_lints",
|
|
||||||
&["-A", "unfulfilled_lint_expectations"]
|
|
||||||
));
|
|
||||||
|
|
||||||
// Check if cargo caching got in the way
|
|
||||||
if let Ok(file) = File::open(metadata_output_path) {
|
|
||||||
if let Ok(metadata) = file.metadata() {
|
|
||||||
if let Ok(last_modification) = metadata.modified() {
|
|
||||||
if last_modification > start_time {
|
|
||||||
// The output file has been modified. Most likely by a hungry
|
|
||||||
// metadata collection monster. So We'll return.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Force cargo to invalidate the caches
|
|
||||||
filetime::set_file_mtime(
|
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("clippy_lints/src/lib.rs"),
|
|
||||||
filetime::FileTime::now(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Running the collection again
|
|
||||||
assert!(run_clippy_for_package(
|
|
||||||
"clippy_lints",
|
|
||||||
&["-A", "unfulfilled_lint_expectations"]
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn run_clippy_for_package(project: &str, args: &[&str]) -> bool {
|
fn run_clippy_for_package(project: &str, args: &[&str]) -> bool {
|
||||||
let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
|
Loading…
Reference in a new issue