Skip to content

Commit

Permalink
Rollup merge of rust-lang#94178 - est31:tolerant_lines_check, r=Mark-…
Browse files Browse the repository at this point in the history
…Simulacrum

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 (a revert of the earlier commit), added again in 448d076,
removed in 3171bd5, added in 438826f,
and removed in bb0a2f9.

To avoid this back and forth, we exempt files from the unneccessary
ignoring warning that have length of at least 70% of the limit.
  • Loading branch information
matthiaskrgr authored Feb 22, 2022
2 parents fa60d8d + 49a5456 commit caeb466
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tools/tidy/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ pub fn check(path: &Path, bad: &mut bool) {
);
};
suppressible_tidy_err!(err, skip_file_length, "");
} else if lines > (LINES * 7) / 10 {
// Just set it to something that doesn't trigger the "unneccessarily ignored" warning.
skip_file_length = Directive::Ignore(true);
}

if let Directive::Ignore(false) = skip_cr {
Expand Down

0 comments on commit caeb466

Please sign in to comment.