diff options
| author | Alex Macleod <alex@macleod.io> | 2025-05-07 14:32:23 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2025-05-07 14:32:23 +0000 |
| commit | 772ea35935c8201abaa8c21387c9eda323d9184f (patch) | |
| tree | 99cdef206e31700b9c4d0b1f1f936427e0e056f6 /tests | |
| parent | cf6bebb3437306b90e97339a197ef495ec620617 (diff) | |
| download | rust-772ea35935c8201abaa8c21387c9eda323d9184f.tar.gz rust-772ea35935c8201abaa8c21387c9eda323d9184f.zip | |
Fix diagnostic paths printed by dogfood test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/dogfood.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/dogfood.rs b/tests/dogfood.rs index 16a1a415102..4ac2bd53285 100644 --- a/tests/dogfood.rs +++ b/tests/dogfood.rs @@ -44,8 +44,8 @@ fn dogfood() { "rustc_tools_util", ] { println!("linting {package}"); - if !run_clippy_for_package(package, &["-D", "clippy::all", "-D", "clippy::pedantic"]) { - failed_packages.push(if package.is_empty() { "root" } else { package }); + if !run_clippy_for_package(package) { + failed_packages.push(package); } } @@ -57,7 +57,7 @@ fn dogfood() { } #[must_use] -fn run_clippy_for_package(project: &str, args: &[&str]) -> bool { +fn run_clippy_for_package(project: &str) -> bool { let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let mut command = Command::new(&*test_utils::CARGO_CLIPPY_PATH); @@ -79,15 +79,17 @@ fn run_clippy_for_package(project: &str, args: &[&str]) -> bool { } } - command.arg("--").args(args); + command.arg("--"); command.arg("-Cdebuginfo=0"); // disable debuginfo to generate less data in the target dir - command.args(["-D", "clippy::dbg_macro"]); - + command.args(["-D", "clippy::all", "-D", "clippy::pedantic", "-D", "clippy::dbg_macro"]); if !cfg!(feature = "internal") { // running a clippy built without internal lints on the clippy source - // that contains e.g. `allow(clippy::invalid_paths)` + // that contains e.g. `allow(clippy::symbol_as_str)` command.args(["-A", "unknown_lints"]); } + // Workaround for not being a workspace, add the crate's directory back to the path + command.args(["--remap-path-prefix", &format!("={project}")]); + command.status().unwrap().success() } |
