diff options
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 950db71ec..e9c0c83db 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -152,24 +152,17 @@ impl ProjectWorkspace { | |||
152 | 152 | ||
153 | pub fn proc_macro_dylib_paths(&self) -> Vec<PathBuf> { | 153 | pub fn proc_macro_dylib_paths(&self) -> Vec<PathBuf> { |
154 | match self { | 154 | match self { |
155 | ProjectWorkspace::Json { project } => { | 155 | ProjectWorkspace::Json { project } => project |
156 | let mut proc_macro_dylib_paths = Vec::with_capacity(project.crates.len()); | 156 | .crates |
157 | for krate in &project.crates { | 157 | .iter() |
158 | if let Some(out_dir) = &krate.proc_macro_dylib_path { | 158 | .filter_map(|krate| krate.proc_macro_dylib_path.as_ref()) |
159 | proc_macro_dylib_paths.push(out_dir.to_path_buf()); | 159 | .cloned() |
160 | } | 160 | .collect(), |
161 | } | 161 | ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => cargo |
162 | proc_macro_dylib_paths | 162 | .packages() |
163 | } | 163 | .filter_map(|pkg| cargo[pkg].proc_macro_dylib_path.as_ref()) |
164 | ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => { | 164 | .cloned() |
165 | let mut proc_macro_dylib_paths = Vec::with_capacity(cargo.packages().len()); | 165 | .collect(), |
166 | for pkg in cargo.packages() { | ||
167 | if let Some(dylib_path) = &cargo[pkg].proc_macro_dylib_path { | ||
168 | proc_macro_dylib_paths.push(dylib_path.to_path_buf()); | ||
169 | } | ||
170 | } | ||
171 | proc_macro_dylib_paths | ||
172 | } | ||
173 | } | 166 | } |
174 | } | 167 | } |
175 | 168 | ||