about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-02-01 16:24:48 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-02-02 09:06:34 +1100
commit47b5d95db8abaaf4fdad878ec3b06dfaa2a1d74f (patch)
tree5f766bad63b12e3243846bc68ca003cf8f290e5f
parentf916f3a36b21629d58e1b8ea4dbddc0db1316903 (diff)
downloadrust-47b5d95db8abaaf4fdad878ec3b06dfaa2a1d74f.tar.gz
rust-47b5d95db8abaaf4fdad878ec3b06dfaa2a1d74f.zip
Remove `FileMatch`.
It's returned from `FileSearch::search` but it's only used to print some
debug info.
-rw-r--r--compiler/rustc_metadata/src/locator.rs9
-rw-r--r--compiler/rustc_session/src/filesearch.rs14
2 files changed, 6 insertions, 17 deletions
diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs
index 13ea089e245..8db65a10c13 100644
--- a/compiler/rustc_metadata/src/locator.rs
+++ b/compiler/rustc_metadata/src/locator.rs
@@ -223,7 +223,7 @@ use rustc_data_structures::sync::MetadataRef;
 use rustc_errors::{struct_span_err, FatalError};
 use rustc_session::config::{self, CrateType};
 use rustc_session::cstore::{CrateSource, MetadataLoader};
-use rustc_session::filesearch::{FileDoesntMatch, FileMatches, FileSearch};
+use rustc_session::filesearch::FileSearch;
 use rustc_session::search_paths::PathKind;
 use rustc_session::utils::CanonicalizedPath;
 use rustc_session::Session;
@@ -396,7 +396,7 @@ impl<'a> CrateLocator<'a> {
         // The goal of this step is to look at as little metadata as possible.
         self.filesearch.search(|spf, kind| {
             let file = match &spf.file_name_str {
-                None => return FileDoesntMatch,
+                None => return,
                 Some(file) => file,
             };
             let (hash, found_kind) = if file.starts_with(&rlib_prefix) && file.ends_with(".rlib") {
@@ -415,7 +415,7 @@ impl<'a> CrateLocator<'a> {
                     staticlibs
                         .push(CrateMismatch { path: spf.path.clone(), got: "static".to_string() });
                 }
-                return FileDoesntMatch;
+                return;
             };
 
             info!("lib candidate: {}", spf.path.display());
@@ -423,7 +423,7 @@ impl<'a> CrateLocator<'a> {
             let (rlibs, rmetas, dylibs) = candidates.entry(hash.to_string()).or_default();
             let path = fs::canonicalize(&spf.path).unwrap_or_else(|_| spf.path.clone());
             if seen_paths.contains(&path) {
-                return FileDoesntMatch;
+                return;
             };
             seen_paths.insert(path.clone());
             match found_kind {
@@ -431,7 +431,6 @@ impl<'a> CrateLocator<'a> {
                 CrateFlavor::Rmeta => rmetas.insert(path, kind),
                 CrateFlavor::Dylib => dylibs.insert(path, kind),
             };
-            FileMatches
         });
         self.crate_rejections.via_kind.extend(staticlibs);
 
diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs
index 9687d0bd8a7..e6ec16b393b 100644
--- a/compiler/rustc_session/src/filesearch.rs
+++ b/compiler/rustc_session/src/filesearch.rs
@@ -1,7 +1,5 @@
 //! A module for searching for libraries
 
-pub use self::FileMatch::*;
-
 use std::env;
 use std::fs;
 use std::iter::FromIterator;
@@ -45,21 +43,13 @@ impl<'a> FileSearch<'a> {
 
     pub fn search<F>(&self, mut pick: F)
     where
-        F: FnMut(&SearchPathFile, PathKind) -> FileMatch,
+        F: FnMut(&SearchPathFile, PathKind),
     {
         for search_path in self.search_paths() {
             debug!("searching {}", search_path.dir.display());
             for spf in search_path.files.iter() {
                 debug!("testing {}", spf.path.display());
-                let maybe_picked = pick(spf, search_path.kind);
-                match maybe_picked {
-                    FileMatches => {
-                        debug!("picked {}", spf.path.display());
-                    }
-                    FileDoesntMatch => {
-                        debug!("rejected {}", spf.path.display());
-                    }
-                }
+                pick(spf, search_path.kind);
             }
         }
     }