Skip to content

Commit 4bd8c92

Browse files
authored
Rollup merge of rust-lang#98717 - RalfJung:make-tidy-less-annoying, r=jyn514
get rid of tidy 'unnecessarily ignored' warnings I think these warnings are quite pointless: when I say `allow(foo)` in my code, that doesn't necessarily mean that I expect `foo` to happen -- it just means that I am okay with `foo` happening. For example, having to add and remove `ignore-tidy-linelength` as the longest line in the file keeps growing and shrinking is just annoying and doesn't benefit anyone, IMO. This usually incurs *two* CI roundtrips: first CI tells you that line lengths in your test file are ignored unnecessarily, so you go and remove that attribute; then CI tells you that now your line numbers changed, so you re-bless your tests (often takes >5min if parts of rustc need rebuilding because `./x.py fmt` changed something somewhere). That's just a lot of wasted effort and time and patience.
2 parents d690171 + 8515475 commit 4bd8c92

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/tools/tidy/src/style.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,6 @@ 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 "unnecessarily ignored" warning.
400-
skip_file_length = Directive::Ignore(true);
401398
}
402399

403400
if let Directive::Ignore(false) = skip_cr {
@@ -406,12 +403,6 @@ pub fn check(path: &Path, bad: &mut bool) {
406403
if let Directive::Ignore(false) = skip_tab {
407404
tidy_error!(bad, "{}: ignoring tab characters unnecessarily", file.display());
408405
}
409-
if let Directive::Ignore(false) = skip_line_length {
410-
tidy_error!(bad, "{}: ignoring line length unnecessarily", file.display());
411-
}
412-
if let Directive::Ignore(false) = skip_file_length {
413-
tidy_error!(bad, "{}: ignoring file length unnecessarily", file.display());
414-
}
415406
if let Directive::Ignore(false) = skip_end_whitespace {
416407
tidy_error!(bad, "{}: ignoring trailing whitespace unnecessarily", file.display());
417408
}
@@ -424,5 +415,9 @@ pub fn check(path: &Path, bad: &mut bool) {
424415
if let Directive::Ignore(false) = skip_copyright {
425416
tidy_error!(bad, "{}: ignoring copyright unnecessarily", file.display());
426417
}
418+
// We deliberately do not warn about these being unnecessary,
419+
// that would just lead to annoying churn.
420+
let _unused = skip_line_length;
421+
let _unused = skip_file_length;
427422
})
428423
}

0 commit comments

Comments
 (0)