Skip to content

Commit ab41cbe

Browse files
committed
[cargo-nextest] exec_run now returns Ok(())
The exit code returned by exec_run was being ignored. Return Ok(()) to make that clearer. We should probably make this `#[must_use]` at some point to prevent this kind of mistake.
1 parent 20c1b2d commit ab41cbe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cargo-nextest/src/dispatch.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ impl NtrOpts {
455455
&self.run_opts.reporter_opts,
456456
cli_args,
457457
output_writer,
458-
)
458+
)?;
459+
Ok(0)
459460
}
460461
}
461462

@@ -1761,7 +1762,7 @@ impl App {
17611762
reporter_opts: &ReporterOpts,
17621763
cli_args: Vec<String>,
17631764
output_writer: &mut OutputWriter,
1764-
) -> Result<i32> {
1765+
) -> Result<()> {
17651766
let pcx = ParseContext::new(self.base.graph());
17661767
let (version_only_config, config) = self.base.load_config(&pcx)?;
17671768
let profile = self.base.load_profile(&config)?;
@@ -1848,7 +1849,7 @@ impl App {
18481849
// Make the runner.
18491850
let Some(runner_builder) = runner_builder else {
18501851
// This means --no-run was passed in. Exit.
1851-
return Ok(0);
1852+
return Ok(());
18521853
};
18531854
let runner = runner_builder.build(
18541855
&test_list,
@@ -1879,12 +1880,12 @@ impl App {
18791880
.check_version_config_final(version_only_config.nextest_version())?;
18801881

18811882
match run_stats.summarize_final() {
1882-
FinalRunStats::Success => Ok(0),
1883+
FinalRunStats::Success => Ok(()),
18831884
FinalRunStats::NoTestsRun => match runner_opts.no_tests {
1884-
Some(NoTestsBehavior::Pass) => Ok(0),
1885+
Some(NoTestsBehavior::Pass) => Ok(()),
18851886
Some(NoTestsBehavior::Warn) => {
18861887
warn!("no tests to run");
1887-
Ok(0)
1888+
Ok(())
18881889
}
18891890
Some(NoTestsBehavior::Fail) => Err(ExpectedError::NoTestsRun { is_default: false }),
18901891
None => Err(ExpectedError::NoTestsRun { is_default: true }),

0 commit comments

Comments
 (0)