Skip to content

Commit 3118ab9

Browse files
authored
Rollup merge of #147323 - chenyukang:yukang-fix-tidy-check, r=jieyouxu
Fix top level ui tests check in tidy I got an error when pushing code: ```console fmt check fmt: checked 6330 modified files tidy check tidy [ui_tests (tests)]: ui tests should be added under meaningful subdirectories: `/Users/yukang/rust/tests/ui/.DS_Store` tidy [ui_tests (tests)]: FAIL ``` I think it's better to use `ignore::WalkBuilder` for checking the path. r? `@jieyouxu`
2 parents 636a744 + 422b914 commit 3118ab9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/tools/tidy/src/ui_tests.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,20 @@ fn deny_new_top_level_ui_tests(check: &mut RunningCheck, tests_path: &Path) {
8181
// - <https://github.com/rust-lang/rust/issues/73494>
8282
// - <https://github.com/rust-lang/rust/issues/133895>
8383

84-
let top_level_ui_tests = walkdir::WalkDir::new(tests_path)
85-
.min_depth(1)
86-
.max_depth(1)
84+
let top_level_ui_tests = ignore::WalkBuilder::new(tests_path)
85+
.max_depth(Some(1))
8786
.follow_links(false)
88-
.same_file_system(true)
89-
.into_iter()
87+
.build()
9088
.flatten()
9189
.filter(|e| {
9290
let file_name = e.file_name();
9391
file_name != ".gitattributes" && file_name != "README.md"
9492
})
95-
.filter(|e| !e.file_type().is_dir());
93+
.filter(|e| !e.file_type().is_some_and(|f| f.is_dir()));
94+
9695
for entry in top_level_ui_tests {
9796
check.error(format!(
98-
"ui tests should be added under meaningful subdirectories: `{}`",
97+
"ui tests should be added under meaningful subdirectories: `{}`, see https://github.com/rust-lang/compiler-team/issues/902",
9998
entry.path().display()
10099
));
101100
}

0 commit comments

Comments
 (0)