From 0cc60617d766220df60749c141533b344ee5f7e7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 12 Jul 2025 11:08:30 +0200 Subject: [PATCH] clippy: fix test filtering when TESTNAME is empty --- tests/compile-test.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index cefe654fef68..a7f38275a602 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -144,8 +144,17 @@ impl TestContext { let target_dir = PathBuf::from(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into())); let mut config = Config { output_conflict_handling: error_on_output_conflict, + // Pre-fill filters with TESTNAME; will be later extended with `self.args`. filter_files: env::var("TESTNAME") - .map(|filters| filters.split(',').map(str::to_string).collect()) + .map(|filters| { + filters + .split(',') + // Make sure that if TESTNAME is empty we produce the empty list here, + // not a list containing an empty string. + .filter(|s| !s.is_empty()) + .map(str::to_string) + .collect() + }) .unwrap_or_default(), target: None, bless_command: Some(if IS_RUSTC_TEST_SUITE {