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`).
This commit is contained in:
varkor 2018-05-11 17:04:50 +01:00 committed by Mark Simulacrum
parent 9d690d40d0
commit ae41d6c32f

View File

@ -22,12 +22,15 @@ pub fn check(path: &Path, bad: &mut bool) {
&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()
);
}
}
},
);