Skip to content

Commit 5791bbf

Browse files
authored
don't ignore all tests
1 parent 83e1fd5 commit 5791bbf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/tidy/src/style.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,10 @@ pub fn check(path: &Path, bad: &mut bool) {
402402
let is_test = file.components().any(|c| c.as_os_str() == "tests")
403403
|| file.file_stem().unwrap() == "tests";
404404
let is_style = file.ends_with(style_file) || style_file.ends_with(file);
405+
let is_style_test = is_test && file.parent().unwrap().ends_with(style_file.with_extension(""));
405406
// scanning the whole file for multiple needles at once is more efficient than
406407
// executing lines times needles separate searches.
407-
let any_problematic_line = !is_style && !is_test && problematic_regex.is_match(contents);
408+
let any_problematic_line = !is_style && !is_style_test && problematic_regex.is_match(contents);
408409
for (i, line) in contents.split('\n').enumerate() {
409410
if line.is_empty() {
410411
if i == 0 {

0 commit comments

Comments
 (0)