Allow running lintcheck with a renamed rust-clippy dir

This commit is contained in:
Alex Macleod 2022-01-06 13:06:24 +00:00
parent 92048f4826
commit 94fe6719de

View File

@ -665,16 +665,6 @@ fn lintcheck_needs_rerun(lintcheck_logs_path: &Path) -> bool {
logs_modified < clippy_modified logs_modified < clippy_modified
} }
fn is_in_clippy_root() -> bool {
if let Ok(pb) = std::env::current_dir() {
if let Some(file) = pb.file_name() {
return file == PathBuf::from("rust-clippy");
}
}
false
}
/// lintchecks `main()` function /// lintchecks `main()` function
/// ///
/// # Panics /// # Panics
@ -683,7 +673,7 @@ fn is_in_clippy_root() -> bool {
/// or if lintcheck is executed from the wrong directory (aka none-repo-root) /// or if lintcheck is executed from the wrong directory (aka none-repo-root)
pub fn main() { pub fn main() {
// assert that we launch lintcheck from the repo root (via cargo lintcheck) // assert that we launch lintcheck from the repo root (via cargo lintcheck)
if !is_in_clippy_root() { if std::fs::metadata("lintcheck/Cargo.toml").is_err() {
eprintln!("lintcheck needs to be run from clippys repo root!\nUse `cargo lintcheck` alternatively."); eprintln!("lintcheck needs to be run from clippys repo root!\nUse `cargo lintcheck` alternatively.");
std::process::exit(3); std::process::exit(3);
} }