Skip to content

Commit e354794

Browse files
committed
optimize the code
1 parent 33ceae8 commit e354794

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bootstrap/builder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,14 @@ impl StepDescription {
302302
}
303303
}
304304

305-
fn maybe_run(&self, builder: &Builder<'_>, pathsets: Vec<PathSet>) {
306-
let excluded_pathsets: Vec<PathSet> =
307-
pathsets.iter().filter(|set| !self.is_excluded(builder, set)).cloned().collect();
305+
fn maybe_run(&self, builder: &Builder<'_>, mut pathsets: Vec<PathSet>) {
306+
pathsets.retain(|set| !self.is_excluded(builder, set));
308307

309308
// Determine the targets participating in this rule.
310309
let targets = if self.only_hosts { &builder.hosts } else { &builder.targets };
311310

312311
for target in targets {
313-
let run = RunConfig { builder, paths: excluded_pathsets.clone(), target: *target };
312+
let run = RunConfig { builder, paths: pathsets.clone(), target: *target };
314313
(self.make_run)(run);
315314
}
316315
}

0 commit comments

Comments
 (0)