Resolve a FIXME

This commit is contained in:
Donough Liu 2020-09-21 16:14:22 +08:00
parent 0242afee81
commit cad893ed04

View file

@ -137,13 +137,10 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
));
}
// FIXME: `(&mut *vtor)(args...)` can be simplified to `vtor(args...)`
// once https://github.com/rust-lang/rust/pull/72280 is landed on stable
// (about 10 weeks from now)
if let Some(ref vtor) = arg.validator {
debug!("Validator::validate_arg_values: checking validator...");
let mut vtor = vtor.lock().unwrap();
if let Err(e) = (&mut *vtor)(&*val.to_string_lossy()) {
if let Err(e) = vtor(&*val.to_string_lossy()) {
debug!("error");
return Err(Error::value_validation(
arg.to_string(),
@ -158,7 +155,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
if let Some(ref vtor) = arg.validator_os {
debug!("Validator::validate_arg_values: checking validator_os...");
let mut vtor = vtor.lock().unwrap();
if let Err(e) = (&mut *vtor)(val) {
if let Err(e) = vtor(val) {
debug!("error");
return Err(Error::value_validation(
arg.to_string(),