Skip to content

Commit

Permalink
Merge pull request #4804 from epage/unstable
Browse files Browse the repository at this point in the history
fix!: Remove stablized `unstable-grouped` feature
  • Loading branch information
epage committed Mar 28, 2023
2 parents 4b180f8 + d5089b2 commit 5b101eb
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 64 deletions.
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

0 comments on commit 5b101eb

Please sign in to comment.