Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).
&libcore_path,
&mut |subpath| t!(subpath.strip_prefix(&libcore_path)).starts_with("tests"),
&mut |subpath| {
- if t!(read_to_string(subpath)).contains("#[test]") {
- tidy_error!(
- bad,
- "{} contains #[test]; libcore tests must be placed inside `src/libcore/tests/`",
- subpath.display()
- );
+ if subpath.ends_with(".rs") {
+ if t!(read_to_string(subpath)).contains("#[test]") {
+ tidy_error!(
+ bad,
+ "{} contains #[test]; libcore tests must be placed inside \
+ `src/libcore/tests/`",
+ subpath.display()
+ );
+ }
}
},
);