1
Fork 0

Inline and remove FileSearch::search.

It has only a single callsite, and having all the code in one place will
make it possible to optimize the search.
This commit is contained in:
Nicholas Nethercote 2022-02-01 16:32:13 +11:00
parent 47b5d95db8
commit 89b61ea09f
2 changed files with 47 additions and 49 deletions

View file

@ -5,7 +5,7 @@ use std::fs;
use std::iter::FromIterator;
use std::path::{Path, PathBuf};
use crate::search_paths::{PathKind, SearchPath, SearchPathFile};
use crate::search_paths::{PathKind, SearchPath};
use rustc_fs_util::fix_windows_verbatim_for_gcc;
use tracing::debug;
@ -41,19 +41,6 @@ impl<'a> FileSearch<'a> {
self.get_lib_path().join("self-contained")
}
pub fn search<F>(&self, mut pick: F)
where
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());
pick(spf, search_path.kind);
}
}
}
pub fn new(
sysroot: &'a Path,
triple: &'a str,