Remove FileMatch
.
It's returned from `FileSearch::search` but it's only used to print some debug info.
This commit is contained in:
parent
f916f3a36b
commit
47b5d95db8
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user