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 stablized unstable-grouped feature #4804

Merged
merged 1 commit into from Mar 28, 2023
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: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -93,7 +93,6 @@ string = ["clap_builder/string"] # Allow runtime generated strings

# In-work features
unstable-replace = ["clap_builder/unstable-replace"]
unstable-grouped = ["clap_builder/unstable-grouped"]
unstable-v5 = ["clap_builder/unstable-v5", "clap_derive?/unstable-v5", "deprecated"]

[lib]
Expand Down
1 change: 0 additions & 1 deletion clap_builder/Cargo.toml
Expand Up @@ -52,7 +52,6 @@ string = [] # Allow runtime generated strings

# In-work features
unstable-replace = []
unstable-grouped = []
unstable-v5 = ["deprecated"]

[lib]
Expand Down
62 changes: 0 additions & 62 deletions clap_builder/src/parser/matches/arg_matches.rs
Expand Up @@ -570,56 +570,6 @@ impl ArgMatches {
!self.args.is_empty()
}

/// Get an [`Iterator`] over groups of values of a specific option.
///
/// specifically grouped by the occurrences of the options.
///
/// Each group is a `Vec<&str>` containing the arguments passed to a single occurrence
/// of the option.
///
/// If the option doesn't support multiple occurrences, or there was only a single occurrence,
/// the iterator will only contain a single item.
///
/// Returns `None` if the option wasn't present.
///
/// # Panics
///
/// If the value is invalid UTF-8.
///
/// If `id` is not a valid argument or group id.
///
/// # Examples
/// ```rust
/// # use clap_builder as clap;
/// # use clap::{Command,Arg, ArgAction};
/// let m = Command::new("myprog")
/// .arg(Arg::new("exec")
/// .short('x')
/// .num_args(1..)
/// .action(ArgAction::Append)
/// .value_terminator(";"))
/// .get_matches_from(vec![
/// "myprog", "-x", "echo", "hi", ";", "-x", "echo", "bye"]);
/// let vals: Vec<Vec<&str>> = m.grouped_values_of("exec").unwrap().collect();
/// assert_eq!(vals, [["echo", "hi"], ["echo", "bye"]]);
/// ```
/// [`Iterator`]: std::iter::Iterator
#[cfg(feature = "unstable-grouped")]
#[cfg_attr(debug_assertions, track_caller)]
#[deprecated(
since = "4.1.0",
note = "Use get_occurrences or remove_occurrences instead"
)]
#[allow(deprecated)]
pub fn grouped_values_of(&self, id: &str) -> Option<GroupedValues> {
let arg = some!(self.get_arg(id));
let v = GroupedValues {
iter: arg.vals().map(|g| g.iter().map(unwrap_string).collect()),
len: arg.vals().len(),
};
Some(v)
}

/// Report where argument value came from
///
/// # Panics
Expand Down Expand Up @@ -1907,18 +1857,6 @@ impl<'a> Default for Indices<'a> {
}
}

#[cfg_attr(debug_assertions, track_caller)]
#[inline]
#[cfg(feature = "unstable-grouped")]
fn unwrap_string(value: &AnyValue) -> &str {
match value.downcast_ref::<String>() {
Some(value) => value,
None => {
panic!("Must use `_os` lookups with `Arg::allow_invalid_utf8`",)
}
}
}

#[track_caller]
fn unwrap_downcast_ref<T: Any + Clone + Send + Sync + 'static>(value: &AnyValue) -> &T {
value.downcast_ref().expect(INTERNAL_ERROR_MSG)
Expand Down