about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-11 08:25:44 +0100
committerGitHub <noreply@github.com>2024-02-11 08:25:44 +0100
commit040ecbfb9f6be4c3dcacc4fc69396580b6206ed9 (patch)
treef71ef335718f8aaacba1c910ad1f68e0ea9511de
parent9bbd146e86548cc278e771c39ab4b712b1e1aa21 (diff)
parent2b95b68304b4bf48031e8dd7cd4754c647022f03 (diff)
downloadrust-040ecbfb9f6be4c3dcacc4fc69396580b6206ed9.tar.gz
rust-040ecbfb9f6be4c3dcacc4fc69396580b6206ed9.zip
Rollup merge of #120763 - Nadrieril:suggest-patterns, r=Mark-Simulacrum
Suggest pattern tests when modifying exhaustiveness

The vast majority of exhaustiveness tests are in `tests/ui/pattern`, this is what I've been using for years. This PR is me telling `x suggest` about that.

cc `@Ezrashaw`
-rw-r--r--src/tools/suggest-tests/src/dynamic_suggestions.rs41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/tools/suggest-tests/src/dynamic_suggestions.rs b/src/tools/suggest-tests/src/dynamic_suggestions.rs
index 2b0213cdc22..f09720f1c91 100644
--- a/src/tools/suggest-tests/src/dynamic_suggestions.rs
+++ b/src/tools/suggest-tests/src/dynamic_suggestions.rs
@@ -4,20 +4,29 @@ use crate::Suggestion;
 
 type DynamicSuggestion = fn(&Path) -> Vec<Suggestion>;
 
-pub(crate) const DYNAMIC_SUGGESTIONS: &[DynamicSuggestion] = &[|path: &Path| -> Vec<Suggestion> {
-    if path.starts_with("compiler/") || path.starts_with("library/") {
-        let path = path.components().take(2).collect::<Vec<_>>();
+pub(crate) const DYNAMIC_SUGGESTIONS: &[DynamicSuggestion] = &[
+    |path: &Path| -> Vec<Suggestion> {
+        if path.starts_with("compiler/") || path.starts_with("library/") {
+            let path = path.components().take(2).collect::<Vec<_>>();
 
-        vec![Suggestion::with_single_path(
-            "test",
-            None,
-            &format!(
-                "{}/{}",
-                path[0].as_os_str().to_str().unwrap(),
-                path[1].as_os_str().to_str().unwrap()
-            ),
-        )]
-    } else {
-        Vec::new()
-    }
-}];
+            vec![Suggestion::with_single_path(
+                "test",
+                None,
+                &format!(
+                    "{}/{}",
+                    path[0].as_os_str().to_str().unwrap(),
+                    path[1].as_os_str().to_str().unwrap()
+                ),
+            )]
+        } else {
+            Vec::new()
+        }
+    },
+    |path: &Path| -> Vec<Suggestion> {
+        if path.starts_with("compiler/rustc_pattern_analysis") {
+            vec![Suggestion::new("test", None, &["tests/ui", "--test-args", "pattern"])]
+        } else {
+            Vec::new()
+        }
+    },
+];