Skip to content

Commit fd85de1

Browse files
committed
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 9e3caa2 commit fd85de1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tools/tidy/src/libcoretest.rs

+9-6
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)