Skip to content

Commit ae41d6c

Browse files
varkorMark-Simulacrum
authored andcommitted
Ignore non .rs files for tidy libcoretest
Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).
1 parent 9d690d4 commit ae41d6c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tools/tidy/src/libcoretest.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ pub fn check(path: &Path, bad: &mut bool) {
2222
&libcore_path,
2323
&mut |subpath| t!(subpath.strip_prefix(&libcore_path)).starts_with("tests"),
2424
&mut |subpath| {
25-
if t!(read_to_string(subpath)).contains("#[test]") {
26-
tidy_error!(
27-
bad,
28-
"{} contains #[test]; libcore tests must be placed inside `src/libcore/tests/`",
29-
subpath.display()
30-
);
25+
if subpath.ends_with(".rs") {
26+
if t!(read_to_string(subpath)).contains("#[test]") {
27+
tidy_error!(
28+
bad,
29+
"{} contains #[test]; libcore tests must be placed inside \
30+
`src/libcore/tests/`",
31+
subpath.display()
32+
);
33+
}
3134
}
3235
},
3336
);

0 commit comments

Comments
 (0)