Skip to content

Commit 2b95b68

Browse files
committed
Suggest pattern tests when modifying exhaustiveness
1 parent 8ace7ea commit 2b95b68

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

src/tools/suggest-tests/src/dynamic_suggestions.rs

+25-16
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@ use crate::Suggestion;
44

55
type DynamicSuggestion = fn(&Path) -> Vec<Suggestion>;
66

7-
pub(crate) const DYNAMIC_SUGGESTIONS: &[DynamicSuggestion] = &[|path: &Path| -> Vec<Suggestion> {
8-
if path.starts_with("compiler/") || path.starts_with("library/") {
9-
let path = path.components().take(2).collect::<Vec<_>>();
7+
pub(crate) const DYNAMIC_SUGGESTIONS: &[DynamicSuggestion] = &[
8+
|path: &Path| -> Vec<Suggestion> {
9+
if path.starts_with("compiler/") || path.starts_with("library/") {
10+
let path = path.components().take(2).collect::<Vec<_>>();
1011

11-
vec![Suggestion::with_single_path(
12-
"test",
13-
None,
14-
&format!(
15-
"{}/{}",
16-
path[0].as_os_str().to_str().unwrap(),
17-
path[1].as_os_str().to_str().unwrap()
18-
),
19-
)]
20-
} else {
21-
Vec::new()
22-
}
23-
}];
12+
vec![Suggestion::with_single_path(
13+
"test",
14+
None,
15+
&format!(
16+
"{}/{}",
17+
path[0].as_os_str().to_str().unwrap(),
18+
path[1].as_os_str().to_str().unwrap()
19+
),
20+
)]
21+
} else {
22+
Vec::new()
23+
}
24+
},
25+
|path: &Path| -> Vec<Suggestion> {
26+
if path.starts_with("compiler/rustc_pattern_analysis") {
27+
vec![Suggestion::new("test", None, &["tests/ui", "--test-args", "pattern"])]
28+
} else {
29+
Vec::new()
30+
}
31+
},
32+
];

0 commit comments

Comments
 (0)