diff --git a/src/builder/app_settings.rs b/src/builder/app_settings.rs index 296642e7..98eb0098 100644 --- a/src/builder/app_settings.rs +++ b/src/builder/app_settings.rs @@ -358,41 +358,6 @@ pub enum AppSettings { )] NoAutoVersion, - /// Deprecated, replaced with [`Command::allow_hyphen_values`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Command::allow_hyphen_values`") - )] - #[doc(hidden)] - AllowLeadingHyphen, - - /// Deprecated, replaced with [`Command::allow_invalid_utf8_for_external_subcommands`] and [`Command::is_allow_invalid_utf8_for_external_subcommands_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Command::allow_invalid_utf8_for_external_subcommands` and `Command::is_allow_invalid_utf8_for_external_subcommands_set`" - ) - )] - #[doc(hidden)] - StrictUtf8, - - /// Deprecated, this is now the default - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "This is now the default") - )] - #[doc(hidden)] - UnifiedHelpMessage, - - /// Deprecated, this is now the default - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "This is now the default") - )] - #[doc(hidden)] - ColoredHelp, - /// Deprecated, see [`Command::color`][crate::Command::color] #[cfg_attr( feature = "deprecated", @@ -417,60 +382,6 @@ pub enum AppSettings { #[doc(hidden)] ColorNever, - /// Deprecated, replaced with [`Command::disable_help_flag`] and [`Command::is_disable_help_flag_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Command::disable_help_flag` and `Command::is_disable_help_flag_set`" - ) - )] - #[doc(hidden)] - DisableHelpFlags, - - /// Deprecated, replaced with [`Command::disable_version_flag`] and - /// [`Command::is_disable_version_flag_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Command::disable_version_flag` and `Command::is_disable_version_flag_set`" - ) - )] - #[doc(hidden)] - DisableVersion, - - /// Deprecated, replaced with [`Command::propagate_version`] and [`Command::is_propagate_version_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Command::propagate_version` and `Command::is_propagate_version_set`" - ) - )] - #[doc(hidden)] - GlobalVersion, - - /// Deprecated, replaced with [`Command::hide_possible_values`] and - /// [`Arg::is_hide_possible_values_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Command::hide_possible_values` and `Arg::is_hide_possible_values_set`" - ) - )] - #[doc(hidden)] - HidePossibleValuesInHelp, - - /// Deprecated, this is now the default - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "This is now the default") - )] - #[doc(hidden)] - UnifiedHelp, - /// If the cmd is already built, used for caching. #[doc(hidden)] Built, @@ -539,22 +450,14 @@ impl_settings! { AppSettings, AppFlags, => Flags::ARGS_NEGATE_SCS, AllowExternalSubcommands => Flags::ALLOW_UNK_SC, - StrictUtf8 - => Flags::NO_OP, AllowInvalidUtf8ForExternalSubcommands => Flags::SC_UTF8_NONE, AllowHyphenValues => Flags::LEADING_HYPHEN, - AllowLeadingHyphen - => Flags::LEADING_HYPHEN, AllowNegativeNumbers => Flags::ALLOW_NEG_NUMS, AllowMissingPositional => Flags::ALLOW_MISSING_POS, - UnifiedHelpMessage - => Flags::NO_OP, - ColoredHelp - => Flags::NO_OP, ColorAlways => Flags::COLOR_ALWAYS, ColorAuto @@ -573,20 +476,12 @@ impl_settings! { AppSettings, AppFlags, => Flags::DISABLE_HELP_SC, DisableHelpFlag => Flags::DISABLE_HELP_FLAG, - DisableHelpFlags - => Flags::DISABLE_HELP_FLAG, DisableVersionFlag => Flags::DISABLE_VERSION_FLAG, - DisableVersion - => Flags::DISABLE_VERSION_FLAG, PropagateVersion => Flags::PROPAGATE_VERSION, - GlobalVersion - => Flags::PROPAGATE_VERSION, HidePossibleValues => Flags::NO_POS_VALUES, - HidePossibleValuesInHelp - => Flags::NO_POS_VALUES, HelpExpected => Flags::HELP_REQUIRED, Hidden @@ -609,7 +504,6 @@ impl_settings! { AppSettings, AppFlags, => Flags::USE_LONG_FORMAT_FOR_HELP_SC, TrailingVarArg => Flags::TRAILING_VARARG, - UnifiedHelp => Flags::NO_OP, NextLineHelp => Flags::NEXT_LINE_HELP, IgnoreErrors diff --git a/src/builder/arg.rs b/src/builder/arg.rs index be183d66..b8821ca0 100644 --- a/src/builder/arg.rs +++ b/src/builder/arg.rs @@ -4633,184 +4633,6 @@ impl<'help> Arg<'help> { } } -/// # Deprecated -impl<'help> Arg<'help> { - /// Deprecated, replaced with [`Arg::new`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::new`") - )] - #[doc(hidden)] - pub fn with_name>(n: S) -> Self { - Self::new(n) - } - - /// Deprecated, replaced with [`Arg::required_unless_present`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::required_unless_present`") - )] - #[doc(hidden)] - #[must_use] - pub fn required_unless(self, arg_id: T) -> Self { - self.required_unless_present(arg_id) - } - - /// Deprecated, replaced with [`Arg::required_unless_present_all`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Arg::required_unless_present_all`" - ) - )] - #[doc(hidden)] - #[must_use] - pub fn required_unless_all(self, names: I) -> Self - where - I: IntoIterator, - T: Key, - { - self.required_unless_present_all(names) - } - - /// Deprecated, replaced with [`Arg::required_unless_present_any`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Arg::required_unless_present_any`" - ) - )] - #[doc(hidden)] - #[must_use] - pub fn required_unless_one(self, names: I) -> Self - where - I: IntoIterator, - T: Key, - { - self.required_unless_present_any(names) - } - - /// Deprecated, replaced with [`Arg::required_if_eq`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq`") - )] - #[doc(hidden)] - #[must_use] - pub fn required_if(self, arg_id: T, val: &'help str) -> Self { - self.required_if_eq(arg_id, val) - } - - /// Deprecated, replaced with [`Arg::required_if_eq_any`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq_any`") - )] - #[doc(hidden)] - #[must_use] - pub fn required_ifs(self, ifs: &[(T, &'help str)]) -> Self { - self.required_if_eq_any(ifs) - } - - /// Deprecated, replaced with [`Arg::hide`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`") - )] - #[doc(hidden)] - #[inline] - #[must_use] - pub fn hidden(self, yes: bool) -> Self { - self.hide(yes) - } - - /// Deprecated, replaced with [`Arg::ignore_case`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`") - )] - #[doc(hidden)] - #[inline] - #[must_use] - pub fn case_insensitive(self, yes: bool) -> Self { - self.ignore_case(yes) - } - - /// Deprecated, replaced with [`Arg::forbid_empty_values`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`") - )] - #[doc(hidden)] - #[must_use] - pub fn empty_values(self, yes: bool) -> Self { - self.forbid_empty_values(!yes) - } - - /// Deprecated, replaced with [`Arg::multiple_occurrences`] (most likely what you want) and - /// [`Arg::multiple_values`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`" - ) - )] - #[doc(hidden)] - #[must_use] - pub fn multiple(self, yes: bool) -> Self { - self.multiple_occurrences(yes).multiple_values(yes) - } - - /// Deprecated, replaced with [`Arg::hide_short_help`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`") - )] - #[doc(hidden)] - #[inline] - #[must_use] - pub fn hidden_short_help(self, yes: bool) -> Self { - self.hide_short_help(yes) - } - - /// Deprecated, replaced with [`Arg::hide_long_help`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`") - )] - #[doc(hidden)] - #[inline] - #[must_use] - pub fn hidden_long_help(self, yes: bool) -> Self { - self.hide_long_help(yes) - } - - /// Deprecated, replaced with [`Arg::setting`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::setting`") - )] - #[doc(hidden)] - #[must_use] - pub fn set(self, s: ArgSettings) -> Self { - self.setting(s) - } - - /// Deprecated, replaced with [`Arg::unset_setting`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Arg::unset_setting`") - )] - #[doc(hidden)] - #[must_use] - pub fn unset(self, s: ArgSettings) -> Self { - self.unset_setting(s) - } -} - /// # Internally used only impl<'help> Arg<'help> { pub(crate) fn _build(&mut self) { diff --git a/src/builder/arg_group.rs b/src/builder/arg_group.rs index a4eba55a..be6615a4 100644 --- a/src/builder/arg_group.rs +++ b/src/builder/arg_group.rs @@ -431,16 +431,6 @@ impl<'help> ArgGroup<'help> { } self } - - /// Deprecated, replaced with [`ArgGroup::new`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `ArgGroup::new`") - )] - #[doc(hidden)] - pub fn with_name>(n: S) -> Self { - Self::new(n) - } } impl<'help> From<&'_ ArgGroup<'help>> for ArgGroup<'help> { diff --git a/src/builder/arg_settings.rs b/src/builder/arg_settings.rs index 624c5d2e..1d57fe23 100644 --- a/src/builder/arg_settings.rs +++ b/src/builder/arg_settings.rs @@ -54,17 +54,6 @@ pub enum ArgSettings { deprecated(since = "3.1.0", note = "Replaced with `Arg::action` (Issue #3772)") )] MultipleOccurrences, - /// Deprecated, see [`ArgSettings::MultipleOccurrences`] (most likely what you want) and - /// [`ArgSettings::MultipleValues`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`" - ) - )] - #[doc(hidden)] - Multiple, /// Deprecated, replaced with [`Arg::value_parser(NonEmptyStringValueParser::new())`] #[cfg_attr( feature = "deprecated", @@ -150,17 +139,6 @@ pub enum ArgSettings { ) )] AllowHyphenValues, - /// Deprecated, replaced with [`Arg::allow_hyphen_values`] and - /// [`Arg::is_allow_hyphen_values_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Arg::allow_hyphen_values` and `Arg::is_allow_hyphen_values_set`" - ) - )] - #[doc(hidden)] - AllowLeadingHyphen, /// Deprecated, replaced with [`Arg::require_equals`] and [`Arg::is_require_equals_set`] #[cfg_attr( feature = "deprecated", @@ -197,16 +175,6 @@ pub enum ArgSettings { ) )] IgnoreCase, - /// Deprecated, replaced with [`Arg::ignore_case`] and [`Arg::is_ignore_case_set`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `Arg::ignore_case` and `Arg::is_ignore_case_set`" - ) - )] - #[doc(hidden)] - CaseInsensitive, /// Deprecated, replaced with [`Arg::hide_env`] and [`Arg::is_hide_env_set`] #[cfg_attr( feature = "deprecated", @@ -301,7 +269,6 @@ impl_settings! { ArgSettings, ArgFlags, Required => Flags::REQUIRED, MultipleOccurrences => Flags::MULTIPLE_OCC, MultipleValues => Flags::MULTIPLE_VALS, - Multiple => Flags::MULTIPLE, ForbidEmptyValues => Flags::NO_EMPTY_VALS, Global => Flags::GLOBAL, Hidden => Flags::HIDDEN, @@ -311,11 +278,9 @@ impl_settings! { ArgSettings, ArgFlags, RequireDelimiter => Flags::REQ_DELIM, HidePossibleValues => Flags::HIDE_POS_VALS, AllowHyphenValues => Flags::ALLOW_TAC_VALS, - AllowLeadingHyphen => Flags::ALLOW_TAC_VALS, RequireEquals => Flags::REQUIRE_EQUALS, Last => Flags::LAST, IgnoreCase => Flags::CASE_INSENSITIVE, - CaseInsensitive => Flags::CASE_INSENSITIVE, #[cfg(feature = "env")] HideEnv => Flags::HIDE_ENV, #[cfg(feature = "env")] diff --git a/src/builder/command.rs b/src/builder/command.rs index 5ffb5f71..c2309fdd 100644 --- a/src/builder/command.rs +++ b/src/builder/command.rs @@ -1756,14 +1756,14 @@ impl<'help> App<'help> { /// # use clap::{Command, AppSettings}; /// Command::new("myprog") /// .setting(AppSettings::SubcommandRequired) - /// .setting(AppSettings::AllowLeadingHyphen) + /// .setting(AppSettings::AllowHyphenValues) /// # ; /// ``` /// or /// ```no_run /// # use clap::{Command, AppSettings}; /// Command::new("myprog") - /// .setting(AppSettings::SubcommandRequired | AppSettings::AllowLeadingHyphen) + /// .setting(AppSettings::SubcommandRequired | AppSettings::AllowHyphenValues) /// # ; /// ``` #[inline] @@ -1786,14 +1786,14 @@ impl<'help> App<'help> { /// # use clap::{Command, AppSettings}; /// Command::new("myprog") /// .unset_setting(AppSettings::SubcommandRequired) - /// .setting(AppSettings::AllowLeadingHyphen) + /// .setting(AppSettings::AllowHyphenValues) /// # ; /// ``` /// or /// ```no_run /// # use clap::{Command, AppSettings}; /// Command::new("myprog") - /// .unset_setting(AppSettings::SubcommandRequired | AppSettings::AllowLeadingHyphen) + /// .unset_setting(AppSettings::SubcommandRequired | AppSettings::AllowHyphenValues) /// # ; /// ``` #[inline] @@ -3776,201 +3776,6 @@ impl<'help> App<'help> { } } -/// Deprecated -impl<'help> App<'help> { - /// Deprecated, replaced with [`Command::override_usage`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::override_usage`") - )] - #[doc(hidden)] - #[must_use] - pub fn usage>(self, usage: S) -> Self { - self.override_usage(usage) - } - - /// Deprecated, replaced with [`Command::override_help`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::override_help`") - )] - #[doc(hidden)] - #[must_use] - pub fn help>(self, help: S) -> Self { - self.override_help(help) - } - - /// Deprecated, replaced with [`Command::mut_arg`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`") - )] - #[doc(hidden)] - #[must_use] - pub fn help_short(self, c: char) -> Self { - self.mut_arg("help", |a| a.short(c)) - } - - /// Deprecated, replaced with [`Command::mut_arg`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`") - )] - #[doc(hidden)] - #[must_use] - pub fn version_short(self, c: char) -> Self { - self.mut_arg("version", |a| a.short(c)) - } - - /// Deprecated, replaced with [`Command::mut_arg`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`") - )] - #[doc(hidden)] - #[must_use] - pub fn help_message(self, s: impl Into<&'help str>) -> Self { - self.mut_arg("help", |a| a.help(s.into())) - } - - /// Deprecated, replaced with [`Command::mut_arg`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`") - )] - #[doc(hidden)] - #[must_use] - pub fn version_message(self, s: impl Into<&'help str>) -> Self { - self.mut_arg("version", |a| a.help(s.into())) - } - - /// Deprecated, replaced with [`Command::help_template`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::help_template`") - )] - #[doc(hidden)] - #[must_use] - pub fn template>(self, s: S) -> Self { - self.help_template(s) - } - - /// Deprecated, replaced with [`Command::setting(a| b)`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::setting(a | b)`") - )] - #[doc(hidden)] - #[must_use] - pub fn settings(mut self, settings: &[AppSettings]) -> Self { - for s in settings { - self.settings.insert((*s).into()); - } - self - } - - /// Deprecated, replaced with [`Command::unset_setting(a| b)`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::unset_setting(a | b)`") - )] - #[doc(hidden)] - #[must_use] - pub fn unset_settings(mut self, settings: &[AppSettings]) -> Self { - for s in settings { - self.settings.remove((*s).into()); - } - self - } - - /// Deprecated, replaced with [`Command::global_setting(a| b)`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::global_setting(a | b)`") - )] - #[doc(hidden)] - #[must_use] - pub fn global_settings(mut self, settings: &[AppSettings]) -> Self { - for s in settings { - self.settings.insert((*s).into()); - self.g_settings.insert((*s).into()); - } - self - } - - /// Deprecated, replaced with [`Command::term_width`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::term_width`") - )] - #[doc(hidden)] - #[must_use] - pub fn set_term_width(self, width: usize) -> Self { - self.term_width(width) - } - - /// Deprecated, replaced with [`Command::render_version`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::render_version`") - )] - #[doc(hidden)] - pub fn write_version(&self, w: &mut W) -> ClapResult<()> { - write!(w, "{}", self.render_version()).map_err(From::from) - } - - /// Deprecated, replaced with [`Command::render_long_version`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::render_long_version`") - )] - #[doc(hidden)] - pub fn write_long_version(&self, w: &mut W) -> ClapResult<()> { - write!(w, "{}", self.render_long_version()).map_err(From::from) - } - - /// Deprecated, replaced with [`Command::try_get_matches`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches`") - )] - #[doc(hidden)] - pub fn get_matches_safe(self) -> ClapResult { - self.try_get_matches() - } - - /// Deprecated, replaced with [`Command::try_get_matches_from`] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches_from`") - )] - #[doc(hidden)] - pub fn get_matches_from_safe(self, itr: I) -> ClapResult - where - I: IntoIterator, - T: Into + Clone, - { - self.try_get_matches_from(itr) - } - - /// Deprecated, replaced with [`Command::try_get_matches_from_mut`] - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.0.0", - note = "Replaced with `App::try_get_matches_from_mut`" - ) - )] - #[doc(hidden)] - pub fn get_matches_from_safe_borrow(&mut self, itr: I) -> ClapResult - where - I: IntoIterator, - T: Into + Clone, - { - self.try_get_matches_from_mut(itr) - } -} - // Internally used only impl<'help> App<'help> { pub(crate) fn get_id(&self) -> Id { diff --git a/src/error/mod.rs b/src/error/mod.rs index 0256374c..a30419c9 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs @@ -134,18 +134,6 @@ impl Error { self.formatted().print() } - /// Deprecated, replaced with [`Command::error`] - /// - /// [`Command::error`]: crate::Command::error - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.0.0", note = "Replaced with `Command::error`") - )] - #[doc(hidden)] - pub fn with_description(description: String, kind: ErrorKind) -> Self { - Error::raw(kind, description) - } - fn new(kind: ErrorKind) -> Self { Self { inner: Box::new(ErrorInner {