diff --git a/src/builder/arg.rs b/src/builder/arg.rs index 583b4dfa..4f4d9f24 100644 --- a/src/builder/arg.rs +++ b/src/builder/arg.rs @@ -1702,24 +1702,6 @@ impl<'help> Arg<'help> { } } - /// Deprecated, replaced with [`Arg::value_parser(NonEmptyStringValueParser::new())`] - #[inline] - #[must_use] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.2.0", - note = "Replaced with `Arg::value_parser(NonEmptyStringValueParser::new())`" - ) - )] - pub fn forbid_empty_values(self, yes: bool) -> Self { - if yes { - self.setting(ArgSettings::ForbidEmptyValues) - } else { - self.unset_setting(ArgSettings::ForbidEmptyValues) - } - } - /// Requires that options use the `--option=val` syntax /// /// i.e. an equals between the option and associated value. @@ -4455,15 +4437,6 @@ impl<'help> Arg<'help> { self.is_set(ArgSettings::AllowHyphenValues) } - /// Deprecated, replaced with [`Arg::get_value_parser()`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.2.0", note = "Replaced with `Arg::get_value_parser()`") - )] - pub fn is_forbid_empty_values_set(&self) -> bool { - self.is_set(ArgSettings::ForbidEmptyValues) - } - /// Deprecated, replaced with [`Arg::get_value_parser()` #[cfg_attr( feature = "deprecated", diff --git a/src/builder/arg_settings.rs b/src/builder/arg_settings.rs index 1d57fe23..88fd83fd 100644 --- a/src/builder/arg_settings.rs +++ b/src/builder/arg_settings.rs @@ -54,15 +54,6 @@ pub enum ArgSettings { deprecated(since = "3.1.0", note = "Replaced with `Arg::action` (Issue #3772)") )] MultipleOccurrences, - /// Deprecated, replaced with [`Arg::value_parser(NonEmptyStringValueParser::new())`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.1.0", - note = "Replaced with `Arg::value_parser(NonEmptyStringValueParser::new())`" - ) - )] - ForbidEmptyValues, /// Deprecated, replaced with [`Arg::global`] and [`Arg::is_global_set`] #[cfg_attr( feature = "deprecated", @@ -237,7 +228,6 @@ bitflags! { struct Flags: u32 { const REQUIRED = 1; const MULTIPLE_OCC = 1 << 1; - const NO_EMPTY_VALS = 1 << 2; const GLOBAL = 1 << 3; const HIDDEN = 1 << 4; const TAKES_VAL = 1 << 5; @@ -269,7 +259,6 @@ impl_settings! { ArgSettings, ArgFlags, Required => Flags::REQUIRED, MultipleOccurrences => Flags::MULTIPLE_OCC, MultipleValues => Flags::MULTIPLE_VALS, - ForbidEmptyValues => Flags::NO_EMPTY_VALS, Global => Flags::GLOBAL, Hidden => Flags::HIDDEN, TakesValue => Flags::TAKES_VAL, diff --git a/src/builder/debug_asserts.rs b/src/builder/debug_asserts.rs index 864b8b47..04e90523 100644 --- a/src/builder/debug_asserts.rs +++ b/src/builder/debug_asserts.rs @@ -747,7 +747,6 @@ fn assert_arg_flags(arg: &Arg) { checker!(is_ignore_case_set requires is_takes_value_set); { #![allow(deprecated)] - checker!(is_forbid_empty_values_set requires is_takes_value_set); checker!(is_allow_invalid_utf8_set requires is_takes_value_set); } } diff --git a/src/error/kind.rs b/src/error/kind.rs index 332c4ca1..1929e457 100644 --- a/src/error/kind.rs +++ b/src/error/kind.rs @@ -93,7 +93,7 @@ pub enum ErrorKind { /// let res = Command::new("prog") /// .arg(Arg::new("color") /// .takes_value(true) - /// .forbid_empty_values(true) + /// .value_parser(clap::builder::NonEmptyStringValueParser::new()) /// .long("color")) /// .try_get_matches_from(vec!["prog", "--color="]); /// assert!(res.is_err()); diff --git a/src/parser/validator.rs b/src/parser/validator.rs index ebf2b234..d1242d62 100644 --- a/src/parser/validator.rs +++ b/src/parser/validator.rs @@ -114,21 +114,6 @@ impl<'help, 'cmd> Validator<'help, 'cmd> { )); } } - { - #![allow(deprecated)] - if arg.is_forbid_empty_values_set() && val.is_empty() { - debug!("Validator::validate_arg_values: illegal empty val found"); - return Err(Error::empty_value( - self.cmd, - &get_possible_values(arg) - .iter() - .filter(|pv| !pv.is_hide_set()) - .map(PossibleValue::get_name) - .collect::>(), - arg.to_string(), - )); - } - } if let Some(ref vtor) = arg.validator { debug!("Validator::validate_arg_values: checking validator...");