Skip to content

Commit 92beef7

Browse files
committed
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
1 parent 95b03b2 commit 92beef7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/dogfood.rs

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

2326
std::env::set_current_dir(root_dir).unwrap();
2427
let output = std::process::Command::new(clippy_cmd)
28+
.env("CLIPPY_DOGFOOD", "1")
2529
.arg("clippy")
2630
.arg("--all-targets")
2731
.arg("--all-features")
@@ -43,6 +47,10 @@ fn dogfood_tests() {
4347
return;
4448
}
4549
let root_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
50+
let clippy_cmd = std::path::Path::new(&root_dir)
51+
.join("target")
52+
.join(env!("PROFILE"))
53+
.join("cargo-clippy");
4654

4755
for d in &[
4856
"clippy_workspace_tests",
@@ -52,10 +60,9 @@ fn dogfood_tests() {
5260
"clippy_dev",
5361
"rustc_tools_util",
5462
] {
55-
let clippy_cmd = std::path::Path::new(&root_dir)
56-
.join("target/debug/cargo-clippy");
5763
std::env::set_current_dir(root_dir.join(d)).unwrap();
58-
let output = std::process::Command::new(clippy_cmd)
64+
let output = std::process::Command::new(&clippy_cmd)
65+
.env("CLIPPY_DOGFOOD", "1")
5966
.arg("clippy")
6067
.arg("--")
6168
.args(&["-D", "clippy::all"])

0 commit comments

Comments
 (0)