@@ -216,7 +216,8 @@ impl Plan {
216
216
. max ( ) ;
217
217
218
218
match max_matching_prefix {
219
- Some ( 0 ) => error ! ( "Modified file didn't correspond to any buildable unit!" ) ,
219
+ Some ( 0 ) => error ! ( "Modified file {} didn't correspond to any buildable unit!" ,
220
+ modified. display( ) ) ,
220
221
Some ( max) => {
221
222
let dirty_units = other_targets. iter ( )
222
223
. filter ( |( _, dir) | max == matching_prefix_components ( modified, dir) )
@@ -479,7 +480,13 @@ impl PackageMap {
479
480
480
481
crate struct JobQueue ( Vec < ProcessBuilder > ) ;
481
482
482
- fn proc_arg < T : AsRef < OsStr > > ( prc : & ProcessBuilder , key : T ) -> Option < & std:: ffi:: OsStr > {
483
+ /// Returns an immediately next argument to the one specified in a given
484
+ /// ProcessBuilder (or `None` if the searched or the next argument could not be found).
485
+ ///
486
+ /// This is useful for returning values for arguments of `--key <value>` format.
487
+ /// For example, if `[.., "--crate-name", "rls", ...]` arguments are specified,
488
+ /// then proc_arg(prc, "--crate-name") returns Some(&OsStr::new("rls"));
489
+ fn proc_argument_value < T : AsRef < OsStr > > ( prc : & ProcessBuilder , key : T ) -> Option < & std:: ffi:: OsStr > {
483
490
let args = prc. get_args ( ) ;
484
491
let ( idx, _) = args. iter ( ) . enumerate ( )
485
492
. find ( |( _, arg) | arg. as_os_str ( ) == key. as_ref ( ) ) ?;
@@ -491,8 +498,9 @@ impl fmt::Debug for JobQueue {
491
498
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
492
499
write ! ( f, "JobQueue: [" ) ?;
493
500
for prog in self . 0 . iter ( ) . rev ( ) {
494
- let name = proc_arg ( prog, "--crate-name" ) . unwrap ( ) ;
495
- let typ_ = proc_arg ( prog, "--crate-type" ) . unwrap_or_else ( || OsStr :: new ( "<unknown>" ) ) ;
501
+ let name = proc_argument_value ( prog, "--crate-name" ) . unwrap ( ) ;
502
+ let typ_ = proc_argument_value ( prog, "--crate-type" )
503
+ . unwrap_or_else ( || OsStr :: new ( "<unknown>" ) ) ;
496
504
write ! ( f, "{:?} ({:?}), " , name, typ_) ;
497
505
}
498
506
write ! ( f, "]" ) ?;
@@ -545,7 +553,8 @@ impl JobQueue {
545
553
546
554
// Send a window/progress notification.
547
555
{
548
- let crate_name = proc_arg ( & job, "--crate-name" ) . and_then ( |x| x. to_str ( ) ) ;
556
+ let crate_name = proc_argument_value ( & job, "--crate-name" )
557
+ . and_then ( |x| x. to_str ( ) ) ;
549
558
let update = match crate_name {
550
559
Some ( name) => ProgressUpdate :: Message ( name. to_owned ( ) ) ,
551
560
None => {
0 commit comments