aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-04-01 00:52:44 +0100
committerveetaha <[email protected]>2020-04-02 19:07:05 +0100
commit987fb26a5b9bb2c4352b688cfa20e0fcc8506216 (patch)
tree752db4db289a8fbf6b4b73d49a9e8822a5a5c0e1 /crates/ra_project_model
parentb7d5172f69204b6d097d80a39dacad3494a26f5e (diff)
Migrate to iterators
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/lib.rs18
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 }