@@ -151,6 +151,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
151151 )
152152 . optflag ( "" , "force-rerun" , "rerun tests even if the inputs are unchanged" )
153153 . optflag ( "" , "only-modified" , "only run tests that result been modified" )
154+ . optflag ( "" , "nocapture" , "" )
154155 . optflag ( "h" , "help" , "show this message" )
155156 . reqopt ( "" , "channel" , "current Rust channel" , "CHANNEL" )
156157 . optopt ( "" , "edition" , "default Rust edition" , "EDITION" ) ;
@@ -304,6 +305,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
304305 force_rerun : matches. opt_present ( "force-rerun" ) ,
305306
306307 target_cfg : LazyCell :: new ( ) ,
308+
309+ nocapture : matches. opt_present ( "nocapture" ) ,
307310 }
308311}
309312
@@ -496,6 +499,13 @@ fn configure_lldb(config: &Config) -> Option<Config> {
496499}
497500
498501pub fn test_opts ( config : & Config ) -> test:: TestOpts {
502+ if env:: var ( "RUST_TEST_NOCAPTURE" ) . is_ok ( ) {
503+ eprintln ! (
504+ "WARNING: RUST_TEST_NOCAPTURE is no longer used. \
505+ Use the `--nocapture` flag instead."
506+ ) ;
507+ }
508+
499509 test:: TestOpts {
500510 exclude_should_panic : false ,
501511 filters : config. filters . clone ( ) ,
@@ -505,10 +515,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
505515 logfile : config. logfile . clone ( ) ,
506516 run_tests : true ,
507517 bench_benchmarks : true ,
508- nocapture : match env:: var ( "RUST_TEST_NOCAPTURE" ) {
509- Ok ( val) => & val != "0" ,
510- Err ( _) => false ,
511- } ,
518+ nocapture : config. nocapture ,
512519 color : config. color ,
513520 shuffle : false ,
514521 shuffle_seed : None ,
0 commit comments