diff options
| author | Kevin Yap <me@kevinyap.ca> | 2017-05-12 00:16:52 -0700 |
|---|---|---|
| committer | Kevin Yap <me@kevinyap.ca> | 2017-05-12 09:57:31 -0700 |
| commit | 99bca6e8c9e147c884200230ea7eaea5d55dfdae (patch) | |
| tree | 1b83edebfdd262f1c260858ecc0ade0bd150c6e5 /src | |
| parent | 39bcd6f425426bfacd7de9fe0378df4bd9263d00 (diff) | |
| download | rust-99bca6e8c9e147c884200230ea7eaea5d55dfdae.tar.gz rust-99bca6e8c9e147c884200230ea7eaea5d55dfdae.zip | |
Add tidy check to detect empty files
Addresses #18439.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/style.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 28a55a8763c..8bf683de870 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -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"); |
