Skip to content

Commit 83e1fd5

Browse files
authored
don't check style_file even relatively
1 parent 6854091 commit 83e1fd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/tidy/src/style.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ pub fn check(path: &Path, bad: &mut bool) {
333333
.case_insensitive(true)
334334
.build()
335335
.unwrap();
336+
let style_file = Path::new(file!());
336337
walk(path, skip, &mut |entry, contents| {
337338
let file = entry.path();
338339
let filename = file.file_name().unwrap().to_string_lossy();
@@ -400,7 +401,7 @@ pub fn check(path: &Path, bad: &mut bool) {
400401
let mut comment_block: Option<(usize, usize)> = None;
401402
let is_test = file.components().any(|c| c.as_os_str() == "tests")
402403
|| file.file_stem().unwrap() == "tests";
403-
let is_style = file.ends_with(file!());
404+
let is_style = file.ends_with(style_file) || style_file.ends_with(file);
404405
// scanning the whole file for multiple needles at once is more efficient than
405406
// executing lines times needles separate searches.
406407
let any_problematic_line = !is_style && !is_test && problematic_regex.is_match(contents);

0 commit comments

Comments
 (0)