From 0442bb9ce0b1f9851442fcc6f8f9dcb3ef88e3ca Mon Sep 17 00:00:00 2001 From: Wayne Warren Date: Fri, 30 Nov 2018 12:54:47 -0600 Subject: [PATCH] Don't change current working directory of cargo tests --- tests/dogfood.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/dogfood.rs b/tests/dogfood.rs index 286af42fd91..c1f02b9fcef 100644 --- a/tests/dogfood.rs +++ b/tests/dogfood.rs @@ -8,11 +8,6 @@ // except according to those terms. #[test] -fn dogfood_runner() { - dogfood(); - dogfood_tests(); -} - fn dogfood() { if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) { return; @@ -23,8 +18,8 @@ fn dogfood() { .join(env!("PROFILE")) .join("cargo-clippy"); - std::env::set_current_dir(root_dir).unwrap(); let output = std::process::Command::new(clippy_cmd) + .current_dir(root_dir) .env("CLIPPY_DOGFOOD", "1") .arg("clippy") .arg("--all-targets") @@ -42,6 +37,7 @@ fn dogfood() { assert!(output.status.success()); } +#[test] fn dogfood_tests() { if option_env!("RUSTC_TEST_SUITE").is_some() || cfg!(windows) { return; @@ -60,8 +56,8 @@ fn dogfood_tests() { "clippy_dev", "rustc_tools_util", ] { - std::env::set_current_dir(root_dir.join(d)).unwrap(); let output = std::process::Command::new(&clippy_cmd) + .current_dir(root_dir.join(d)) .env("CLIPPY_DOGFOOD", "1") .arg("clippy") .arg("--")