mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Migrate to iters some more
This commit is contained in:
parent
987fb26a5b
commit
a90401aeed
1 changed files with 11 additions and 18 deletions
|
@ -152,24 +152,17 @@ impl ProjectWorkspace {
|
|||
|
||||
pub fn proc_macro_dylib_paths(&self) -> Vec<PathBuf> {
|
||||
match self {
|
||||
ProjectWorkspace::Json { project } => {
|
||||
let mut proc_macro_dylib_paths = Vec::with_capacity(project.crates.len());
|
||||
for krate in &project.crates {
|
||||
if let Some(out_dir) = &krate.proc_macro_dylib_path {
|
||||
proc_macro_dylib_paths.push(out_dir.to_path_buf());
|
||||
}
|
||||
}
|
||||
proc_macro_dylib_paths
|
||||
}
|
||||
ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => {
|
||||
let mut proc_macro_dylib_paths = Vec::with_capacity(cargo.packages().len());
|
||||
for pkg in cargo.packages() {
|
||||
if let Some(dylib_path) = &cargo[pkg].proc_macro_dylib_path {
|
||||
proc_macro_dylib_paths.push(dylib_path.to_path_buf());
|
||||
}
|
||||
}
|
||||
proc_macro_dylib_paths
|
||||
}
|
||||
ProjectWorkspace::Json { project } => project
|
||||
.crates
|
||||
.iter()
|
||||
.filter_map(|krate| krate.proc_macro_dylib_path.as_ref())
|
||||
.cloned()
|
||||
.collect(),
|
||||
ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => cargo
|
||||
.packages()
|
||||
.filter_map(|pkg| cargo[pkg].proc_macro_dylib_path.as_ref())
|
||||
.cloned()
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue