@@ -316,7 +316,8 @@ fn optgroups() -> Vec<getopts::OptGroup> {
316
316
getopts:: optflag( "h" , "help" , "Display this message (longer with --help)" ) ,
317
317
getopts:: optopt( "" , "logfile" , "Write logs to the specified file instead \
318
318
of stdout", "PATH" ) ,
319
- getopts:: optflag( "" , "no-capture" , "don't capture stdout/stderr of each \
319
+ getopts:: optflag( "" , "nocapture" , "Deprecated. Use --no-capture." ) ,
320
+ getopts:: optflag( "" , "no-capture" , "Don't capture stdout/stderr of each \
320
321
task, allow printing directly") ,
321
322
getopts:: optopt( "" , "color" , "Configure coloring of output:
322
323
auto = colorize if stdout is a tty and tests are run on serially (default);
@@ -386,6 +387,17 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
386
387
no_capture = env:: var ( "RUST_TEST_NO_CAPTURE" ) . is_ok ( ) ;
387
388
}
388
389
390
+ // Warn on deprecated options but still accept them.
391
+ if matches. opt_present ( "nocapture" ) {
392
+ warn ( "--nocapture is deprecated. Use --no-capture instead." ) ;
393
+ no_capture = true ;
394
+ }
395
+
396
+ if env:: var ( "RUST_TEST_NOCAPTURE" ) . is_ok ( ) {
397
+ warn ( "RUST_TEST_NOCAPTURE is deprecated. Use RUST_TEST_NO_CAPTURE instead." ) ;
398
+ no_capture = true ;
399
+ }
400
+
389
401
let color = match matches. opt_str ( "color" ) . as_ref ( ) . map ( |s| & * * s) {
390
402
Some ( "auto" ) | None => AutoColor ,
391
403
Some ( "always" ) => AlwaysColor ,
@@ -409,6 +421,11 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
409
421
Some ( Ok ( test_opts) )
410
422
}
411
423
424
+ /// Writes a warning message to stderr.
425
+ fn warn ( message : & str ) {
426
+ writeln ! ( io:: stderr( ) , "WARN: {}" , message) . unwrap ( ) ;
427
+ }
428
+
412
429
#[ derive( Clone , PartialEq ) ]
413
430
pub struct BenchSamples {
414
431
ns_iter_summ : stats:: Summary ,
0 commit comments