]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/tidy/src/bins.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / src / tools / tidy / src / bins.rs
index b898f20a5d018b30a0b47bbd6452ca25547adc04..197e9a9965f7d729b4f728b0e4eb641d755e1786 100644 (file)
@@ -57,8 +57,8 @@ mod os_impl {
             match fs::File::create(&path) {
                 Ok(file) => {
                     let exec = is_executable(&path).unwrap_or(false);
-                    std::mem::drop(file);
-                    std::fs::remove_file(&path).expect("Deleted temp file");
+                    drop(file);
+                    fs::remove_file(&path).expect("Deleted temp file");
                     // If the file is executable, then we assume that this
                     // filesystem does not track executability, so skip this check.
                     return if exec { Unsupported } else { Supported };
@@ -101,23 +101,11 @@ mod os_impl {
 
         const ALLOWED: &[&str] = &["configure", "x"];
 
+        // FIXME: we don't need to look at all binaries, only files that have been modified in this branch
+        // (e.g. using `git ls-files`).
         walk_no_read(
-            path,
-            &mut |path| {
-                filter_dirs(path)
-                    || path.ends_with("src/etc")
-                    // This is a list of directories that we almost certainly
-                    // don't need to walk. A future PR will likely want to
-                    // remove these in favor of crate::walk_no_read using git
-                    // ls-files to discover the paths we should check, which
-                    // would naturally ignore all of these directories. It's
-                    // also likely faster than walking the directory tree
-                    // directly (since git is just reading from a couple files
-                    // to produce the results).
-                    || path.ends_with("target")
-                    || path.ends_with("build")
-                    || path.ends_with(".git")
-            },
+            &[path],
+            |path, _is_dir| filter_dirs(path) || path.ends_with("src/etc"),
             &mut |entry| {
                 let file = entry.path();
                 let extension = file.extension();