about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-10-04 10:22:52 +0000
committerbors <bors@rust-lang.org>2025-10-04 10:22:52 +0000
commit99b9a8850349e56247acb6ce19910c7f96db8439 (patch)
treebcac326e04e18c4a8e5d65ab2f0bd580ed33181c
parenta0f398e89df9767c93c81cd58d44fdba071258a8 (diff)
parent422b91443f1016aec2a1f00316d01a117ddc7829 (diff)
downloadrust-master.tar.gz
rust-master.zip
Auto merge of #147323 - chenyukang:yukang-fix-tidy-check, r=jieyouxu HEAD master
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`
-rw-r--r--src/tools/tidy/src/ui_tests.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 12eca47c171..c74ecf3d43f 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -81,21 +81,20 @@ fn deny_new_top_level_ui_tests(check: &mut RunningCheck, tests_path: &Path) {
     // - <https://github.com/rust-lang/rust/issues/73494>
     // - <https://github.com/rust-lang/rust/issues/133895>
 
-    let top_level_ui_tests = walkdir::WalkDir::new(tests_path)
-        .min_depth(1)
-        .max_depth(1)
+    let top_level_ui_tests = ignore::WalkBuilder::new(tests_path)
+        .max_depth(Some(1))
         .follow_links(false)
-        .same_file_system(true)
-        .into_iter()
+        .build()
         .flatten()
         .filter(|e| {
             let file_name = e.file_name();
             file_name != ".gitattributes" && file_name != "README.md"
         })
-        .filter(|e| !e.file_type().is_dir());
+        .filter(|e| !e.file_type().is_some_and(|f| f.is_dir()));
+
     for entry in top_level_ui_tests {
         check.error(format!(
-            "ui tests should be added under meaningful subdirectories: `{}`",
+            "ui tests should be added under meaningful subdirectories: `{}`, see https://github.com/rust-lang/compiler-team/issues/902",
             entry.path().display()
         ));
     }