Skip to content

Commit 312c0d0

Browse files
committed
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
1 parent ff19325 commit 312c0d0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/dogfood.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ fn dogfood() {
1919
return;
2020
}
2121
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
22-
let clippy_cmd = std::path::Path::new(&root_dir).join("target/debug/cargo-clippy");
22+
let clippy_cmd = std::path::Path::new(&root_dir)
23+
.join("target")
24+
.join(env!("PROFILE"))
25+
.join("cargo-clippy");
2326

2427
std::env::set_current_dir(root_dir).unwrap();
2528
let output = std::process::Command::new(clippy_cmd)
29+
.env("CLIPPY_DOGFOOD", "1")
2630
.arg("clippy")
2731
.arg("--all-targets")
2832
.arg("--all-features")
@@ -44,6 +48,10 @@ fn dogfood_tests() {
4448
return;
4549
}
4650
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
51+
let clippy_cmd = std::path::Path::new(&root_dir)
52+
.join("target")
53+
.join(env!("PROFILE"))
54+
.join("cargo-clippy");
4755

4856
for d in &[
4957
"clippy_workspace_tests",
@@ -53,10 +61,9 @@ fn dogfood_tests() {
5361
"clippy_dev",
5462
"rustc_tools_util",
5563
] {
56-
let clippy_cmd = std::path::Path::new(&root_dir)
57-
.join("target/debug/cargo-clippy");
5864
std::env::set_current_dir(root_dir.join(d)).unwrap();
59-
let output = std::process::Command::new(clippy_cmd)
65+
let output = std::process::Command::new(&clippy_cmd)
66+
.env("CLIPPY_DOGFOOD", "1")
6067
.arg("clippy")
6168
.arg("--")
6269
.args(&["-D", "clippy::all"])

0 commit comments

Comments
 (0)