Skip to content

Commit

Permalink
Auto merge of rust-lang#8234 - Alexendoo:lintcheck-allow-renamed-dir,…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
bors committed Jan 7, 2022
2 parents 92048f4 + 94fe671 commit be7cf76
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lintcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit be7cf76

Please sign in to comment.