@@ -201,6 +201,12 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package,
201
201
// a real job. Packages which are *not* compiled still have their jobs
202
202
// executed, but only if the work is fresh. This is to preserve their
203
203
// artifacts if any exist.
204
+ let job = if compiled {
205
+ Job :: new as fn ( Work , Work ) -> Job
206
+ } else {
207
+ Job :: noop as fn ( Work , Work ) -> Job
208
+ } ;
209
+
204
210
if !compiled { jobs. ignore ( pkg) ; }
205
211
206
212
if targets. is_empty ( ) {
@@ -252,8 +258,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package,
252
258
try!( work. call ( desc_tx. clone ( ) ) ) ;
253
259
dirty. call ( desc_tx)
254
260
} ) ;
255
- dst. push ( ( if compiled { Job :: new ( dirty, fresh) }
256
- else { Job :: noop ( dirty, fresh) } , freshness) ) ;
261
+ dst. push ( ( job ( dirty, fresh) , freshness) ) ;
257
262
}
258
263
259
264
// If this is a custom build command, we need to not only build the
@@ -290,8 +295,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package,
290
295
}
291
296
let ( dirty, fresh, freshness) =
292
297
try!( custom_build:: prepare ( pkg, target, req, cx) ) ;
293
- run_custom. push ( ( if compiled { Job :: new ( dirty, fresh) }
294
- else { Job :: noop ( dirty, fresh) } , freshness) ) ;
298
+ run_custom. push ( ( job ( dirty, fresh) , freshness) ) ;
295
299
}
296
300
297
301
// If no build scripts were run, no need to compile the build script!
@@ -330,8 +334,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package,
330
334
dirty. call ( desc_tx)
331
335
} ) ;
332
336
jobs. enqueue ( pkg, Stage :: BuildCustomBuild , vec ! [ ] ) ;
333
- jobs. enqueue ( pkg, Stage :: RunCustomBuild , vec ! [ ( if compiled { Job :: new( dirty, fresh) }
334
- else { Job :: noop( dirty, fresh) } , freshness) ] ) ;
337
+ jobs. enqueue ( pkg, Stage :: RunCustomBuild , vec ! [ ( job( dirty, fresh) , freshness) ] ) ;
335
338
}
336
339
337
340
jobs. enqueue ( pkg, Stage :: Libraries , libs) ;
0 commit comments