refactor(cli/flags): use an optional non zero usize for fail-fast (#11804)

Changes the type of the `fail_fast` flag from `Option<usize>` to
`Option<NonZeroUsize>` as an optional value of zero isn't sound.
This commit is contained in:
Casper Beyer 2021-08-23 18:37:02 +08:00 committed by GitHub
parent 198699faba
commit f3b2f23a1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 16 deletions

View file

@ -469,7 +469,7 @@ pub async fn run_tests(
doc_modules: Vec<ModuleSpecifier>,
test_modules: Vec<ModuleSpecifier>,
no_run: bool,
fail_fast: Option<usize>,
fail_fast: Option<NonZeroUsize>,
quiet: bool,
allow_none: bool,
filter: Option<String>,
@ -621,7 +621,7 @@ pub async fn run_tests(
}
if let Some(x) = fail_fast {
if summary.failed >= x {
if summary.failed >= x.get() {
break;
}
}