From a3356aae43c72ea035290e9140e38e2becbc94e0 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 23 Jul 2022 21:23:06 -0500 Subject: [PATCH 1/2] fix!: Remove more deprecated APIs --- src/builder/command.rs | 29 +---------------------------- src/builder/possible_value.rs | 16 ---------------- src/parser/matches/arg_matches.rs | 18 ------------------ 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/src/builder/command.rs b/src/builder/command.rs index 549cd4e4213..7f14c716b48 100644 --- a/src/builder/command.rs +++ b/src/builder/command.rs @@ -482,7 +482,7 @@ impl<'help> Command<'help> { /// } /// ``` pub fn debug_assert(mut self) { - self._build_all(); + self.build(); } /// Custom error message for post-parsing validation @@ -3732,33 +3732,6 @@ impl<'help> Command<'help> { Ok(matcher.into_inner()) } - #[doc(hidden)] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.1.10", note = "Replaced with `Command::build`") - )] - pub fn _build_all(&mut self) { - self.build(); - } - - #[doc(hidden)] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.1.10", note = "Replaced with `Command::build`") - )] - pub fn _build(&mut self) { - self._build_self() - } - - #[doc(hidden)] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.1.13", note = "Replaced with `Command::build`") - )] - pub fn _build_bin_names(&mut self) { - self._build_bin_names_internal(); - } - /// Prepare for introspecting on all included [`Command`]s /// /// Call this on the top-level [`Command`] when done building and before reading state for diff --git a/src/builder/possible_value.rs b/src/builder/possible_value.rs index 9c55ff1daa1..06bc2b4128d 100644 --- a/src/builder/possible_value.rs +++ b/src/builder/possible_value.rs @@ -172,22 +172,6 @@ impl<'help> PossibleValue<'help> { !self.hide && self.help.is_some() } - /// Get the name if argument value is not hidden, `None` otherwise - #[cfg_attr( - feature = "deprecated", - deprecated( - since = "3.1.4", - note = "Use `PossibleValue::is_hide_set` and `PossibleValue::get_name`" - ) - )] - pub fn get_visible_name(&self) -> Option<&'help str> { - if self.hide { - None - } else { - Some(self.name) - } - } - /// Get the name if argument value is not hidden, `None` otherwise, /// but wrapped in quotes if it contains whitespace pub(crate) fn get_visible_quoted_name(&self) -> Option> { diff --git a/src/parser/matches/arg_matches.rs b/src/parser/matches/arg_matches.rs index a60bf7d8459..d7c473d11d9 100644 --- a/src/parser/matches/arg_matches.rs +++ b/src/parser/matches/arg_matches.rs @@ -672,24 +672,6 @@ impl ArgMatches { }; Some(i) } - - #[inline] - #[doc(hidden)] - #[cfg_attr( - feature = "deprecated", - deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::try_get_one()`") - )] - pub fn is_valid_arg(&self, _id: impl Key) -> bool { - #[cfg(debug_assertions)] - { - let id = Id::from(_id); - id == Id::empty_hash() || self.valid_args.contains(&id) - } - #[cfg(not(debug_assertions))] - { - true - } - } } /// # Subcommands From dad2492de0530b4ba50350a5428aca7e069fb901 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 23 Jul 2022 21:24:11 -0500 Subject: [PATCH 2/2] docs: Note change in derive behavior --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 708568b2416..137b9eb8bef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - *(help)* Make `DeriveDisplayOrder` the default and removed the setting. To sort help, set `next_display_order(None)` (#2808) - *(help)* Subcommand display order respects `Command::next_display_order` instead of `DeriveDisplayOrder` and using its own initial display order value (#2808) - *(env)* Parse `--help` and `--version` like any `ArgAction::SetTrue` flag (#3776) +- *(derive)* Changed the default for arguments from `parse` to `value_parser`., removing `parse` support - *(derive)* `subcommand_required(true).arg_required_else_help(true)` is set instead of `SubcommandRequiredElseHelp` (#3280) ### Features