Fix part of the non_fmt_panic

This commit is contained in:
ldm0 2021-02-12 05:36:31 +00:00
parent 97343e4cef
commit 580d8d2c63
5 changed files with 6 additions and 4 deletions

View file

@ -83,6 +83,7 @@ fn test_parse_hex() {
let err = HexOpt::try_parse_from(&["test", "-n", "gg"]).unwrap_err(); let err = HexOpt::try_parse_from(&["test", "-n", "gg"]).unwrap_err();
assert!( assert!(
err.to_string().contains("invalid digit found in string"), err.to_string().contains("invalid digit found in string"),
"{}",
err err
); );
} }

View file

@ -149,6 +149,7 @@ fn test_parse_hex_function_path() {
let err = HexOpt::try_parse_from(&["test", "-n", "gg"]).unwrap_err(); let err = HexOpt::try_parse_from(&["test", "-n", "gg"]).unwrap_err();
assert!( assert!(
err.to_string().contains("invalid digit found in string"), err.to_string().contains("invalid digit found in string"),
"{}",
err err
); );
} }

View file

@ -39,7 +39,7 @@ clap = { path = "../", version = "3.0.0-beta.2" }
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6" pretty_assertions = "0.6"
version-sync = "0.8" version-sync = "0.9"
[features] [features]
default = [] default = []

View file

@ -2318,11 +2318,11 @@ impl<'help> App<'help> {
.collect(); .collect();
if !args_missing_help.is_empty() { if !args_missing_help.is_empty() {
panic!(format!( panic!(
"AppSettings::HelpRequired is enabled for the App {}, but at least one of its arguments does not have either `help` or `long_help` set. List of such arguments: {}", "AppSettings::HelpRequired is enabled for the App {}, but at least one of its arguments does not have either `help` or `long_help` set. List of such arguments: {}",
self.name, self.name,
args_missing_help.join(", ") args_missing_help.join(", ")
)); );
} }
} }

View file

@ -242,7 +242,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
)); ));
} }
panic!(INTERNAL_ERROR_MSG); panic!("{}", INTERNAL_ERROR_MSG);
} }
fn validate_conflicts(&mut self, matcher: &mut ArgMatcher) -> ClapResult<()> { fn validate_conflicts(&mut self, matcher: &mut ArgMatcher) -> ClapResult<()> {