Skip to content

Commit 21cae01

Browse files
committed
Refactor JobQueue::run slightly
Take a `&Context` argument instead of a few component arguments, avoids passing around some extraneous information.
1 parent b36594d commit 21cae01

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
207207
) -> CargoResult<()> {
208208
let mut tokens = Vec::new();
209209
let mut queue = Vec::new();
210-
let build_plan = cx.bcx.build_config.build_plan;
211210
let mut print = DiagnosticPrinter::new(cx.bcx.config);
212211
trace!("queue: {:#?}", self.queue);
213212

@@ -240,7 +239,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
240239
// we're able to perform some parallel work.
241240
while error.is_none() && self.active.len() < tokens.len() + 1 && !queue.is_empty() {
242241
let (key, job) = queue.remove(0);
243-
self.run(key, job, cx.bcx.config, scope, build_plan)?;
242+
self.run(key, job, cx, scope)?;
244243
}
245244

246245
// If after all that we're not actually running anything then we're
@@ -358,7 +357,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
358357
"{} [{}] target(s) in {}",
359358
build_type, opt_type, time_elapsed
360359
);
361-
if !build_plan {
360+
if !cx.bcx.build_config.build_plan {
362361
cx.bcx.config.shell().status("Finished", message)?;
363362
}
364363
Ok(())
@@ -389,9 +388,8 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
389388
&mut self,
390389
key: Key<'a>,
391390
job: Job,
392-
config: &Config,
391+
cx: &Context<'_, '_>,
393392
scope: &Scope<'a>,
394-
build_plan: bool,
395393
) -> CargoResult<()> {
396394
info!("start: {:?}", key);
397395

@@ -405,9 +403,9 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
405403
my_tx.send(Message::Finish(key, res)).unwrap();
406404
};
407405

408-
if !build_plan {
406+
if !cx.bcx.build_config.build_plan {
409407
// Print out some nice progress information.
410-
self.note_working_on(config, &key, fresh)?;
408+
self.note_working_on(cx.bcx.config, &key, fresh)?;
411409
}
412410

413411
match fresh {

0 commit comments

Comments
 (0)