about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-07 20:31:24 +0000
committerbors <bors@rust-lang.org>2022-01-07 20:31:24 +0000
commitbe7cf763693d71e5893d7ec406f859e316ed4b05 (patch)
treef6bf2aa08c25b734f938474ff5bfa293f18c3c92
parent92048f4826a445872eb50760a4f46a92837b243e (diff)
parent94fe6719de0846b2ea88ff2dc517074c8c68c334 (diff)
downloadrust-be7cf763693d71e5893d7ec406f859e316ed4b05.tar.gz
rust-be7cf763693d71e5893d7ec406f859e316ed4b05.zip
Auto merge of #8234 - Alexendoo:lintcheck-allow-renamed-dir, r=xFrednet
Allow running lintcheck with a renamed rust-clippy dir

I have Clippy checked out in `rust/clippy` rather than `rust/rust-clippy`, this allows lintcheck to still run in that case

changelog: none
-rw-r--r--lintcheck/src/main.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/lintcheck/src/main.rs b/lintcheck/src/main.rs
index 53e669254cf..9af8dcc7726 100644
--- a/lintcheck/src/main.rs
+++ b/lintcheck/src/main.rs
@@ -665,16 +665,6 @@ fn lintcheck_needs_rerun(lintcheck_logs_path: &Path) -> bool {
     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
 ///
 /// # Panics
@@ -683,7 +673,7 @@ fn is_in_clippy_root() -> bool {
 /// or if lintcheck is executed from the wrong directory (aka none-repo-root)
 pub fn main() {
     // 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.");
         std::process::exit(3);
     }