Skip to content

Commit 0442bb9

Browse files
committed
Don't change current working directory of cargo tests
1 parent 87d517d commit 0442bb9

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tests/dogfood.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// except according to those terms.
99

1010
#[test]
11-
fn dogfood_runner() {
12-
dogfood();
13-
dogfood_tests();
14-
}
15-
1611
fn dogfood() {
1712
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
1813
return;
@@ -23,8 +18,8 @@ fn dogfood() {
2318
.join(env!("PROFILE"))
2419
.join("cargo-clippy");
2520

26-
std::env::set_current_dir(root_dir).unwrap();
2721
let output = std::process::Command::new(clippy_cmd)
22+
.current_dir(root_dir)
2823
.env("CLIPPY_DOGFOOD", "1")
2924
.arg("clippy")
3025
.arg("--all-targets")
@@ -42,6 +37,7 @@ fn dogfood() {
4237
assert!(output.status.success());
4338
}
4439

40+
#[test]
4541
fn dogfood_tests() {
4642
if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) {
4743
return;
@@ -60,8 +56,8 @@ fn dogfood_tests() {
6056
"clippy_dev",
6157
"rustc_tools_util",
6258
] {
63-
std::env::set_current_dir(root_dir.join(d)).unwrap();
6459
let output = std::process::Command::new(&clippy_cmd)
60+
.current_dir(root_dir.join(d))
6561
.env("CLIPPY_DOGFOOD", "1")
6662
.arg("clippy")
6763
.arg("--")

0 commit comments

Comments
 (0)