@@ -848,9 +848,7 @@ pub struct TestRunnerOpts {
848
848
#[ arg( long, conflicts_with = "no-run" , overrides_with = "fail-fast" ) ]
849
849
no_fail_fast : bool ,
850
850
851
- /// Behavior if there are no tests to run.
852
- ///
853
- /// The default is currently `warn`, but it will change to `fail` in the future.
851
+ /// Behavior if there are no tests to run [default: fail]
854
852
#[ arg(
855
853
long,
856
854
value_enum,
@@ -862,13 +860,12 @@ pub struct TestRunnerOpts {
862
860
no_tests : Option < NoTestsBehavior > ,
863
861
}
864
862
865
- #[ derive( Clone , Copy , Debug , Default , ValueEnum ) ]
863
+ #[ derive( Clone , Copy , Debug , ValueEnum ) ]
866
864
enum NoTestsBehavior {
867
865
/// Silently exit with code 0.
868
866
Pass ,
869
867
870
868
/// Produce a warning and exit with code 0.
871
- #[ default]
872
869
Warn ,
873
870
874
871
/// Produce an error message and exit with code 4.
@@ -1798,27 +1795,15 @@ impl App {
1798
1795
1799
1796
match run_stats. summarize_final ( ) {
1800
1797
FinalRunStats :: Success => Ok ( 0 ) ,
1801
- FinalRunStats :: NoTestsRun => {
1802
- match runner_opts. no_tests {
1803
- Some ( NoTestsBehavior :: Pass ) => Ok ( 0 ) ,
1804
- Some ( NoTestsBehavior :: Warn ) => {
1805
- warn ! ( "no tests to run" ) ;
1806
- Ok ( 0 )
1807
- }
1808
- Some ( NoTestsBehavior :: Fail ) => {
1809
- Err ( ExpectedError :: NoTestsRun { is_default : false } )
1810
- }
1811
- None => {
1812
- // This currently does not exit with a non-zero code, but will in the
1813
- // future: https://github.com/nextest-rs/nextest/issues/1639
1814
- warn ! (
1815
- "no tests to run -- this will become an error in the future\n \
1816
- (hint: use `--no-tests` to customize)"
1817
- ) ;
1818
- Ok ( 0 )
1819
- }
1798
+ FinalRunStats :: NoTestsRun => match runner_opts. no_tests {
1799
+ Some ( NoTestsBehavior :: Pass ) => Ok ( 0 ) ,
1800
+ Some ( NoTestsBehavior :: Warn ) => {
1801
+ warn ! ( "no tests to run" ) ;
1802
+ Ok ( 0 )
1820
1803
}
1821
- }
1804
+ Some ( NoTestsBehavior :: Fail ) => Err ( ExpectedError :: NoTestsRun { is_default : false } ) ,
1805
+ None => Err ( ExpectedError :: NoTestsRun { is_default : true } ) ,
1806
+ } ,
1822
1807
FinalRunStats :: Cancelled ( RunStatsFailureKind :: SetupScript )
1823
1808
| FinalRunStats :: Failed ( RunStatsFailureKind :: SetupScript ) => {
1824
1809
Err ( ExpectedError :: setup_script_failed ( ) )
0 commit comments