2926: Put `grouped_values_of` behind a feature gate r=pksunkara a=epage



2948: docs(generate): Move derive example to generate r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
This commit is contained in:
bors[bot] 2021-10-26 20:56:20 +00:00 committed by GitHub
commit f9e074e554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 18 additions and 13 deletions

View file

@ -41,7 +41,7 @@ jobs:
test-full: test-full:
name: Tests (Full) name: Tests (Full)
env: env:
FLAGS: --features 'wrap_help yaml regex unstable-replace unstable-multicall' FLAGS: --features 'wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -80,7 +80,7 @@ jobs:
- name: Default features - name: Default features
run: cargo check --all-targets run: cargo check --all-targets
- name: All features + Debug - name: All features + Debug
run: cargo check --all-targets --features "wrap_help yaml regex unstable-replace unstable-multicall debug" run: cargo check --all-targets --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped debug"
- name: No features - name: No features
run: cargo check --all-targets --no-default-features --features "std cargo" run: cargo check --all-targets --no-default-features --features "std cargo"
- name: UI Tests - name: UI Tests

View file

@ -97,19 +97,19 @@ jobs:
if: matrix.features == 'all' if: matrix.features == 'all'
with: with:
command: test command: test
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall" args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped"
- name: Check debug - name: Check debug
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: matrix.features == 'all' if: matrix.features == 'all'
with: with:
command: check command: check
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall debug" args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped debug"
- name: Test release - name: Test release
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: matrix.features == 'release' if: matrix.features == 'release'
with: with:
command: test command: test
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall" --release args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped" --release
nightly: nightly:
name: Nightly Tests name: Nightly Tests
strategy: strategy:
@ -139,19 +139,19 @@ jobs:
if: matrix.features == 'all' if: matrix.features == 'all'
with: with:
command: test command: test
args: --features "wrap_help yaml regex unstable-replace unstable-multicall" args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped"
- name: Check debug - name: Check debug
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: matrix.features == 'all' if: matrix.features == 'all'
with: with:
command: check command: check
args: --features "wrap_help yaml regex unstable-replace unstable-multicall debug" args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped debug"
- name: Test release - name: Test release
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: matrix.features == 'release' if: matrix.features == 'release'
with: with:
command: test command: test
args: --features "wrap_help yaml regex unstable-replace unstable-multicall" --release args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped" --release
wasm: wasm:
name: Wasm Check name: Wasm Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -172,4 +172,4 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: check command: check
args: --target ${{ matrix.target }} --features "yaml regex unstable-replace unstable-multicall" args: --target ${{ matrix.target }} --features "yaml regex unstable-replace unstable-multicall unstable-grouped"

View file

@ -31,7 +31,7 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: llvm-cov command: llvm-cov
args: --features "wrap_help yaml regex unstable-replace unstable-multicall" --lcov --output-path lcov.info args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped" --lcov --output-path lcov.info
- name: Coveralls - name: Coveralls
uses: coverallsapp/github-action@master uses: coverallsapp/github-action@master
with: with:

View file

@ -32,7 +32,7 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: clippy command: clippy
args: --features "wrap_help yaml regex unstable-replace unstable-multicall" -- -D warnings args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped" -- -D warnings
- name: Format check - name: Format check
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:

View file

@ -118,6 +118,7 @@ yaml = ["yaml-rust"]
# In-work features # In-work features
unstable-replace = [] unstable-replace = []
unstable-multicall = [] unstable-multicall = []
unstable-grouped = []
[profile.test] [profile.test]
opt-level = 1 opt-level = 1
@ -127,7 +128,7 @@ lto = true
codegen-units = 1 codegen-units = 1
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["yaml", "regex", "unstable-replace", "unstable-multicall"] features = ["yaml", "regex", "unstable-replace", "unstable-multicall", "unstable-grouped"]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[workspace] [workspace]

View file

@ -478,6 +478,7 @@ These features are opt-in. But be wary that they can contain breaking changes be
* **unstable-replace**: Enable [`App::replace`](https://github.com/clap-rs/clap/issues/2836) * **unstable-replace**: Enable [`App::replace`](https://github.com/clap-rs/clap/issues/2836)
* **unstable-multicall**: Enable [`AppSettings::Multicall`](https://github.com/clap-rs/clap/issues/2861) * **unstable-multicall**: Enable [`AppSettings::Multicall`](https://github.com/clap-rs/clap/issues/2861)
* **unstable-grouped**: Enable [`ArgMatches::grouped_values_of`](https://github.com/clap-rs/clap/issues/2924)
### More Information ### More Information

View file

@ -40,7 +40,6 @@ proc-macro-error = "1"
[dev-dependencies] [dev-dependencies]
clap = { path = "../" } clap = { path = "../" }
clap_generate = { path = "../clap_generate" }
trybuild = "1.0" trybuild = "1.0"
rustversion = "1" rustversion = "1"
version-sync = "0.9" version-sync = "0.9"

View file

@ -36,6 +36,7 @@ clap = { path = "../", version = "=3.0.0-beta.5", default-features = false, feat
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.7" pretty_assertions = "0.7"
version-sync = "0.9" version-sync = "0.9"
clap = { path = "../", version = "=3.0.0-beta.5", default-features = false, features = ["std", "derive"] }
[features] [features]
default = [] default = []

View file

@ -247,6 +247,7 @@ impl ArgMatches {
} }
/// Placeholder documentation. /// Placeholder documentation.
#[cfg(feature = "unstable-grouped")]
pub fn grouped_values_of<T: Key>(&self, id: T) -> Option<GroupedValues> { pub fn grouped_values_of<T: Key>(&self, id: T) -> Option<GroupedValues> {
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
let arg_values: for<'a> fn( let arg_values: for<'a> fn(

View file

@ -1,3 +1,5 @@
#![cfg(feature = "unstable-grouped")]
mod utils; mod utils;
use clap::{App, AppSettings, Arg}; use clap::{App, AppSettings, Arg};