Migrate to iters some more

This commit is contained in:
veetaha 2020-04-01 03:01:30 +03:00
parent 987fb26a5b
commit a90401aeed

View file

@ -152,24 +152,17 @@ impl ProjectWorkspace {
pub fn proc_macro_dylib_paths(&self) -> Vec<PathBuf> { pub fn proc_macro_dylib_paths(&self) -> Vec<PathBuf> {
match self { match self {
ProjectWorkspace::Json { project } => { ProjectWorkspace::Json { project } => project
let mut proc_macro_dylib_paths = Vec::with_capacity(project.crates.len()); .crates
for krate in &project.crates { .iter()
if let Some(out_dir) = &krate.proc_macro_dylib_path { .filter_map(|krate| krate.proc_macro_dylib_path.as_ref())
proc_macro_dylib_paths.push(out_dir.to_path_buf()); .cloned()
} .collect(),
} ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => cargo
proc_macro_dylib_paths .packages()
} .filter_map(|pkg| cargo[pkg].proc_macro_dylib_path.as_ref())
ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => { .cloned()
let mut proc_macro_dylib_paths = Vec::with_capacity(cargo.packages().len()); .collect(),
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
}
} }
} }