Skip to content

Commit ac02b64

Browse files
Rollup merge of rust-lang#41935 - iKevinY:detect-empty-files, r=Mark-Simulacrum
Add tidy check to detect empty files Addresses rust-lang#18439.
2 parents f6bf99a + 99bca6e commit ac02b64

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/tools/tidy/src/style.rs

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ pub fn check(path: &Path, bad: &mut bool) {
107107

108108
contents.truncate(0);
109109
t!(t!(File::open(file), file).read_to_string(&mut contents));
110+
111+
if contents.is_empty() {
112+
tidy_error!(bad, "{}: empty file", file.display());
113+
}
114+
110115
let skip_cr = contents.contains("ignore-tidy-cr");
111116
let skip_tab = contents.contains("ignore-tidy-tab");
112117
let skip_length = contents.contains("ignore-tidy-linelength");

0 commit comments

Comments
 (0)