Skip to content

Commit b20daab

Browse files
committed
rustbuild: zip once instead of zipping on each use
1 parent f12d91f commit b20daab

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/bootstrap/builder.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,13 @@ impl StepDescription {
183183
}
184184

185185
fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) {
186-
let should_runs =
187-
v.iter().map(|desc| (desc.should_run)(ShouldRun::new(builder))).collect::<Vec<_>>();
186+
let should_runs = v
187+
.iter()
188+
.map(|desc| (desc, (desc.should_run)(ShouldRun::new(builder))))
189+
.collect::<Vec<_>>();
188190

189191
// sanity checks on rules
190-
for (desc, should_run) in v.iter().zip(&should_runs) {
192+
for (desc, should_run) in should_runs.iter() {
191193
assert!(
192194
!should_run.paths.is_empty(),
193195
"{:?} should have at least one pathset",
@@ -196,7 +198,7 @@ impl StepDescription {
196198
}
197199

198200
if paths.is_empty() || builder.config.include_default_paths {
199-
for (desc, should_run) in v.iter().zip(&should_runs) {
201+
for (desc, should_run) in should_runs.iter() {
200202
if desc.default && should_run.is_really_default() {
201203
for pathset in &should_run.paths {
202204
desc.maybe_run(builder, pathset);
@@ -213,7 +215,7 @@ impl StepDescription {
213215
};
214216

215217
let mut attempted_run = false;
216-
for (desc, should_run) in v.iter().zip(&should_runs) {
218+
for (desc, should_run) in should_runs.iter() {
217219
if let Some(suite) = should_run.is_suite_path(path) {
218220
attempted_run = true;
219221
desc.maybe_run(builder, suite);

0 commit comments

Comments
 (0)