about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-20 06:13:10 +0000
committerbors <bors@rust-lang.org>2023-03-20 06:13:10 +0000
commite91364bcf5100017a8bd5b18cdebefdd3e5f0bb1 (patch)
treebd6f8517c64a103a210a406efc1b0bfbf34d8c20 /src/tools
parent9d0eac4d02da8a1b139ff3dca7fc4b458fb99eb6 (diff)
parent130923586d109afbd0eebe87a020c2b971652962 (diff)
downloadrust-e91364bcf5100017a8bd5b18cdebefdd3e5f0bb1.tar.gz
rust-e91364bcf5100017a8bd5b18cdebefdd3e5f0bb1.zip
Auto merge of #109376 - matthiaskrgr:rollup-0aut57k, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #109249 (Update names/comments for new return-position impl trait in trait lowering strategy)
 - #109259 (rustdoc: Fix missing private inlining)
 - #109269 (rustdoc: cleanup some intermediate allocs)
 - #109301 (fix: fix ICE in `custom-test-frameworks` feature)
 - #109319 (Add test for `c_variadic` in rustdoc-json)
 - #109323 (Ignore files in .gitignore in mir opt check)
 - #109331 (rustdoc: implement bag semantics for function parameter search)
 - #109337 (Improve `Iterator::collect_into` documentation)
 - #109351 (rustdoc: Remove footnote references from doc summary)
 - #109353 (Fix wrong crate name in custom MIR docs)
 - #109362 (Split `items` from `-Zmeta-stats` in two.)
 - #109370 (fix ClashingExternDeclarations lint ICE)
 - #109375 (rustdoc: Fix improper escaping of deprecation reasons)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tidy/src/mir_opt_tests.rs41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs
index 2a9dcac2e8d..b316e9e9009 100644
--- a/src/tools/tidy/src/mir_opt_tests.rs
+++ b/src/tools/tidy/src/mir_opt_tests.rs
@@ -3,19 +3,24 @@
 use std::collections::HashSet;
 use std::path::{Path, PathBuf};
 
+use crate::walk::walk_no_read;
+
 fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
     let mut rs_files = Vec::<PathBuf>::new();
     let mut output_files = HashSet::<PathBuf>::new();
-    let files = walkdir::WalkDir::new(&path.join("mir-opt")).into_iter();
 
-    for file in files.filter_map(Result::ok).filter(|e| e.file_type().is_file()) {
-        let filepath = file.path();
-        if filepath.extension() == Some("rs".as_ref()) {
-            rs_files.push(filepath.to_owned());
-        } else {
-            output_files.insert(filepath.to_owned());
-        }
-    }
+    walk_no_read(
+        &[&path.join("mir-opt")],
+        |path| path.file_name() == Some("README.md".as_ref()),
+        &mut |file| {
+            let filepath = file.path();
+            if filepath.extension() == Some("rs".as_ref()) {
+                rs_files.push(filepath.to_owned());
+            } else {
+                output_files.insert(filepath.to_owned());
+            }
+        },
+    );
 
     for file in rs_files {
         for bw in [32, 64] {
@@ -26,16 +31,14 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
     }
 
     for extra in output_files {
-        if extra.file_name() != Some("README.md".as_ref()) {
-            if !bless {
-                tidy_error!(
-                    bad,
-                    "the following output file is not associated with any mir-opt test, you can remove it: {}",
-                    extra.display()
-                );
-            } else {
-                let _ = std::fs::remove_file(extra);
-            }
+        if !bless {
+            tidy_error!(
+                bad,
+                "the following output file is not associated with any mir-opt test, you can remove it: {}",
+                extra.display()
+            );
+        } else {
+            let _ = std::fs::remove_file(extra);
         }
     }
 }