1
Fork 0

linker: Avoid some allocations in search directory iteration

This commit is contained in:
Vadim Petrochenkov 2024-04-12 00:09:43 +03:00
parent aa6a697a1c
commit 4ded0b82ca
4 changed files with 21 additions and 22 deletions

View file

@ -47,8 +47,8 @@ impl<'a> FileSearch<'a> {
}
/// Returns just the directories within the search paths.
pub fn search_path_dirs(&self) -> Vec<PathBuf> {
self.search_paths().map(|sp| sp.dir.to_path_buf()).collect()
pub fn search_path_dirs(&self) -> impl Iterator<Item = &'a Path> {
self.search_paths().map(|sp| &*sp.dir)
}
}