about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-07-12 11:08:30 +0200
committerRalf Jung <post@ralfj.de>2025-07-12 11:11:29 +0200
commit73edfe7b7395aad2ee55c57cabc8cee9edfbf462 (patch)
treeb9d5eeb37ebf61c62b3d6ea521f92bbe453a61c4 /src/tools
parent855e0fe46e68d94e9f6147531b75ac2d488c548e (diff)
downloadrust-73edfe7b7395aad2ee55c57cabc8cee9edfbf462.tar.gz
rust-73edfe7b7395aad2ee55c57cabc8cee9edfbf462.zip
clippy: fix test filtering when TESTNAME is empty
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clippy/tests/compile-test.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs
index cefe654fef6..a7f38275a60 100644
--- a/src/tools/clippy/tests/compile-test.rs
+++ b/src/tools/clippy/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 {