Skip to content

Commit 49a5456

Browse files
committed
tidy: fire less "ignoring file length unneccessarily" warnings
This avoids a situation where a file is at the border of the limit, and alternates between hitting the limit and not hitting it, causing a back and forth of addition of the ignore-tidy-linelength directive. As an example, consider the ignore-tidy-filelength of compiler/rustc_typeck/src/collect.rs. It was added in 2ca4964, removed in 37354eb, added again in 448d076, removed in 3171bd5, added in 438826f, and #94142 is going to remove it again. To avoid this back and forth, we exempt files from the unneccessary ignoring warning that have length of at least 70% of the limit.
1 parent b8c56fa commit 49a5456

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tools/tidy/src/style.rs

+3
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ pub fn check(path: &Path, bad: &mut bool) {
395395
);
396396
};
397397
suppressible_tidy_err!(err, skip_file_length, "");
398+
} else if lines > (LINES * 7) / 10 {
399+
// Just set it to something that doesn't trigger the "unneccessarily ignored" warning.
400+
skip_file_length = Directive::Ignore(true);
398401
}
399402

400403
if let Directive::Ignore(false) = skip_cr {

0 commit comments

Comments
 (0)