about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-02 16:07:07 +0000
committerbors <bors@rust-lang.org>2023-12-02 16:07:07 +0000
commitda27c979e29e78362b7a2a91ebcf605cb01da94c (patch)
treed5cac57dfdd499c555ac71a1aca080ba96bff166
parent31aa0b2bbe53a53e0de91a36fb9a2bb1833d7bbb (diff)
parent1e67f6c0fbb221a42cf4ecc829334f5db795e798 (diff)
downloadrust-da27c979e29e78362b7a2a91ebcf605cb01da94c.tar.gz
rust-da27c979e29e78362b7a2a91ebcf605cb01da94c.zip
Auto merge of #11905 - pgerber:tests, r=dswij
Tolerate hidden, binary files in tests/

Avoid scanning temporary files created by editors like this one created by Vim:

---- old_test_headers stdout ----
thread 'old_test_headers' panicked at tests/headers.rs:19:74: tests/ui/.regex.rs.swp: stream did not contain valid UTF-8 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

changelog: none
-rw-r--r--tests/headers.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/headers.rs b/tests/headers.rs
index 7eec9a9cdd2..d1f986ef526 100644
--- a/tests/headers.rs
+++ b/tests/headers.rs
@@ -12,7 +12,12 @@ fn old_test_headers() {
 
     for entry in WalkDir::new("tests") {
         let entry = entry.unwrap();
-        if !entry.file_type().is_file() {
+        let is_hidden_file = entry
+            .file_name()
+            .to_str()
+            .expect("non-UTF-8 file name")
+            .starts_with('.');
+        if is_hidden_file || !entry.file_type().is_file() {
             continue;
         }