Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: Remove more deprecated APIs #3981

Merged
merged 2 commits into from Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
29 changes: 1 addition & 28 deletions src/builder/command.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions src/builder/possible_value.rs
Expand Up @@ -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<Cow<'help, str>> {
Expand Down
18 changes: 0 additions & 18 deletions src/parser/matches/arg_matches.rs
Expand Up @@ -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
Expand Down