diff options
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index a133243b4..950db71ec 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -142,22 +142,10 @@ impl ProjectWorkspace { | |||
142 | pub fn out_dirs(&self) -> Vec<PathBuf> { | 142 | pub fn out_dirs(&self) -> Vec<PathBuf> { |
143 | match self { | 143 | match self { |
144 | ProjectWorkspace::Json { project } => { | 144 | ProjectWorkspace::Json { project } => { |
145 | let mut out_dirs = Vec::with_capacity(project.crates.len()); | 145 | project.crates.iter().filter_map(|krate| krate.out_dir.as_ref()).cloned().collect() |
146 | for krate in &project.crates { | ||
147 | if let Some(out_dir) = &krate.out_dir { | ||
148 | out_dirs.push(out_dir.to_path_buf()); | ||
149 | } | ||
150 | } | ||
151 | out_dirs | ||
152 | } | 146 | } |
153 | ProjectWorkspace::Cargo { cargo, sysroot: _sysroot } => { | 147 | ProjectWorkspace::Cargo { cargo, sysroot: _ } => { |
154 | let mut out_dirs = Vec::with_capacity(cargo.packages().len()); | 148 | cargo.packages().filter_map(|pkg| cargo[pkg].out_dir.as_ref()).cloned().collect() |
155 | for pkg in cargo.packages() { | ||
156 | if let Some(out_dir) = &cargo[pkg].out_dir { | ||
157 | out_dirs.push(out_dir.to_path_buf()); | ||
158 | } | ||
159 | } | ||
160 | out_dirs | ||
161 | } | 149 | } |
162 | } | 150 | } |
163 | } | 151 | } |