Skip to content

Commit 0ab9d01

Browse files
Handle windows paths as well
1 parent 20f1b1c commit 0ab9d01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/tools/tidy/src/error_codes_check.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ const EXEMPTED_FROM_TEST: &[&str] = &[
1717
// Some error codes don't have any tests apparently...
1818
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0570", "E0601", "E0602", "E0729"];
1919

20+
// If the file path contains any of these, we don't want to try to extract error codes from it.
21+
//
22+
// We need to declare each path in the windows version (with backslash).
23+
const PATHS_TO_IGNORE_FOR_EXTRACTION: &[&str] =
24+
&["src/test/", "src\\test\\", "src/doc/", "src\\doc\\", "src/tools/", "src\\tools\\"];
25+
2026
#[derive(Default, Debug)]
2127
struct ErrorCodeStatus {
2228
has_test: bool,
@@ -220,7 +226,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) {
220226
found_tests += 1;
221227
} else if entry.path().extension() == Some(OsStr::new("rs")) {
222228
let path = entry.path().to_string_lossy();
223-
if ["src/test/", "src/doc/", "src/tools/"].iter().all(|c| !path.contains(c)) {
229+
if PATHS_TO_IGNORE_FOR_EXTRACTION.iter().all(|c| !path.contains(c)) {
224230
extract_error_codes_from_source(contents, &mut error_codes, &regex);
225231
}
226232
}

0 commit comments

Comments
 (0)