Add tidy check to detect empty files

Addresses #18439.
This commit is contained in:
Kevin Yap 2017-05-12 00:16:52 -07:00
parent 39bcd6f425
commit 99bca6e8c9

View File

@ -107,6 +107,11 @@ pub fn check(path: &Path, bad: &mut bool) {
contents.truncate(0);
t!(t!(File::open(file), file).read_to_string(&mut contents));
if contents.is_empty() {
tidy_error!(bad, "{}: empty file", file.display());
}
let skip_cr = contents.contains("ignore-tidy-cr");
let skip_tab = contents.contains("ignore-tidy-tab");
let skip_length = contents.contains("ignore-tidy-linelength");