diff --git a/src/parse/errors.rs b/src/parse/errors.rs index 0b98255babd..bc476ecb6c6 100644 --- a/src/parse/errors.rs +++ b/src/parse/errors.rs @@ -491,9 +491,7 @@ impl Error { pub fn use_stderr(&self) -> bool { !matches!( self.kind, - ErrorKind::DisplayHelp - | ErrorKind::DisplayVersion - | ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand + ErrorKind::DisplayHelp | ErrorKind::DisplayVersion ) } diff --git a/tests/app_settings.rs b/tests/app_settings.rs index 8fae6107ed0..655e8bffe41 100644 --- a/tests/app_settings.rs +++ b/tests/app_settings.rs @@ -260,6 +260,7 @@ fn arg_required_else_help() { .setting(AppSettings::ArgRequiredElseHelp) .arg(Arg::new("test").index(1)) .try_get_matches_from(vec![""]); + assert!(result.is_err()); let err = result.err().unwrap(); assert_eq!( @@ -274,6 +275,7 @@ fn arg_required_else_help_over_reqs() { .setting(AppSettings::ArgRequiredElseHelp) .arg(Arg::new("test").index(1).required(true)) .try_get_matches_from(vec![""]); + assert!(result.is_err()); let err = result.err().unwrap(); assert_eq!( @@ -297,7 +299,7 @@ fn arg_required_else_help_error_message() { app, "test", ARG_REQUIRED_ELSE_HELP, - false + true // Unlike normal displaying of help, we should provide a fatal exit code )); } @@ -307,6 +309,7 @@ fn subcommand_required_else_help() { .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand(App::new("info")) .try_get_matches_from(&[""]); + assert!(result.is_err()); let err = result.err().unwrap(); assert_eq!( @@ -325,7 +328,7 @@ fn subcommand_required_else_help_error_message() { app, "test", SUBCOMMAND_REQUIRED_ELSE_HELP, - false + true // Unlike normal displaying of help, we should provide a fatal exit code )); }