@@ -152,6 +152,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
152152 )
153153 . optflag ( "" , "force-rerun" , "rerun tests even if the inputs are unchanged" )
154154 . optflag ( "" , "only-modified" , "only run tests that result been modified" )
155+ . optflag ( "" , "nocapture" , "" )
155156 . optflag ( "h" , "help" , "show this message" )
156157 . reqopt ( "" , "channel" , "current Rust channel" , "CHANNEL" )
157158 . optopt ( "" , "edition" , "default Rust edition" , "EDITION" ) ;
@@ -310,6 +311,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
310311 force_rerun : matches. opt_present ( "force-rerun" ) ,
311312
312313 target_cfg : LazyCell :: new ( ) ,
314+
315+ nocapture : matches. opt_present ( "nocapture" ) ,
313316 }
314317}
315318
@@ -502,6 +505,13 @@ fn configure_lldb(config: &Config) -> Option<Config> {
502505}
503506
504507pub fn test_opts ( config : & Config ) -> test:: TestOpts {
508+ if env:: var ( "RUST_TEST_NOCAPTURE" ) . is_ok ( ) {
509+ eprintln ! (
510+ "WARNING: RUST_TEST_NOCAPTURE is no longer used. \
511+ Use the `--nocapture` flag instead."
512+ ) ;
513+ }
514+
505515 test:: TestOpts {
506516 exclude_should_panic : false ,
507517 filters : config. filters . clone ( ) ,
@@ -511,10 +521,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
511521 logfile : config. logfile . clone ( ) ,
512522 run_tests : true ,
513523 bench_benchmarks : true ,
514- nocapture : match env:: var ( "RUST_TEST_NOCAPTURE" ) {
515- Ok ( val) => & val != "0" ,
516- Err ( _) => false ,
517- } ,
524+ nocapture : config. nocapture ,
518525 color : config. color ,
519526 shuffle : false ,
520527 shuffle_seed : None ,
0 commit comments