linker: Avoid some allocations in search directory iteration
This commit is contained in:
parent
aa6a697a1c
commit
4ded0b82ca
4 changed files with 21 additions and 22 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue