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

Do not include --all-features in feature combination if --exclude-features passed #86

Merged
merged 1 commit into from
Nov 3, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]

* `cargo-hack` no longer include `--all-features` in feature combination if one or more features already excluded.

* Diagnostic improvements.

## [0.4.1] - 2020-10-24
Expand Down
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ For more information try --help

exclude_no_default_features |= no_default_features || !include_features.is_empty();
exclude_all_features |= !include_features.is_empty();
exclude_all_features |= !exclude_features.is_empty();
exclude_features.extend_from_slice(&features);

Ok(Args {
Expand Down
54 changes: 24 additions & 30 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,10 @@ fn each_feature_skip_success() {
.assert_success()
.assert_stderr_contains(
"
running `cargo check --no-default-features` on real (1/5)
running `cargo check --no-default-features --features b` on real (2/5)
running `cargo check --no-default-features --features c` on real (3/5)
running `cargo check --no-default-features --features default` on real (4/5)
running `cargo check --no-default-features --all-features` on real (5/5)
running `cargo check --no-default-features` on real (1/4)
running `cargo check --no-default-features --features b` on real (2/4)
running `cargo check --no-default-features --features c` on real (3/4)
running `cargo check --no-default-features --features default` on real (4/4)
",
)
.assert_stderr_not_contains("--features a");
Expand All @@ -670,10 +669,9 @@ fn each_feature_skip_success() {
.assert_success()
.assert_stderr_contains(
"
running `cargo check --no-default-features` on real (1/4)
running `cargo check --no-default-features --features c` on real (2/4)
running `cargo check --no-default-features --features default` on real (3/4)
running `cargo check --no-default-features --all-features` on real (4/4)
running `cargo check --no-default-features` on real (1/3)
running `cargo check --no-default-features --features c` on real (2/3)
running `cargo check --no-default-features --features default` on real (3/3)
",
)
.assert_stderr_not_contains(
Expand All @@ -686,10 +684,9 @@ fn each_feature_skip_success() {
.assert_success()
.assert_stderr_contains(
"
running `cargo check --no-default-features` on real (1/4)
running `cargo check --no-default-features --features c` on real (2/4)
running `cargo check --no-default-features --features default` on real (3/4)
running `cargo check --no-default-features --all-features` on real (4/4)
running `cargo check --no-default-features` on real (1/3)
running `cargo check --no-default-features --features c` on real (2/3)
running `cargo check --no-default-features --features default` on real (3/3)
",
)
.assert_stderr_not_contains(
Expand All @@ -705,15 +702,14 @@ fn powerset_skip_success() {
.assert_success()
.assert_stderr_contains(
"
running `cargo check --no-default-features` on real (1/9)
running `cargo check --no-default-features --features b` on real (2/9)
running `cargo check --no-default-features --features c` on real (3/9)
running `cargo check --no-default-features --features b,c` on real (4/9)
running `cargo check --no-default-features --features default` on real (5/9)
running `cargo check --no-default-features --features b,default` on real (6/9)
running `cargo check --no-default-features --features c,default` on real (7/9)
running `cargo check --no-default-features --features b,c,default` on real (8/9)
running `cargo check --no-default-features --all-features` on real (9/9)
running `cargo check --no-default-features` on real (1/8)
running `cargo check --no-default-features --features b` on real (2/8)
running `cargo check --no-default-features --features c` on real (3/8)
running `cargo check --no-default-features --features b,c` on real (4/8)
running `cargo check --no-default-features --features default` on real (5/8)
running `cargo check --no-default-features --features b,default` on real (6/8)
running `cargo check --no-default-features --features c,default` on real (7/8)
running `cargo check --no-default-features --features b,c,default` on real (8/8)
",
)
.assert_stderr_not_contains(
Expand All @@ -731,11 +727,10 @@ fn exclude_features_default() {
.assert_success()
.assert_stderr_not_contains("running `cargo check` on real")
.assert_stderr_contains(
"running `cargo check --no-default-features` on real (1/5)
running `cargo check --no-default-features --features a` on real (2/5)
running `cargo check --no-default-features --features b` on real (3/5)
running `cargo check --no-default-features --features c` on real (4/5)
running `cargo check --no-default-features --all-features` on real (5/5)",
"running `cargo check --no-default-features` on real (1/4)
running `cargo check --no-default-features --features a` on real (2/4)
running `cargo check --no-default-features --features b` on real (3/4)
running `cargo check --no-default-features --features c` on real (4/4)",
);
}

Expand Down Expand Up @@ -1028,9 +1023,8 @@ fn skip_optional_deps() {
.assert_success()
.assert_stderr_contains(
"
running `cargo check --no-default-features` on optional_deps (1/3)
running `cargo check --no-default-features --features renemed` on optional_deps (2/3)
running `cargo check --no-default-features --all-features` on optional_deps (3/3)
running `cargo check --no-default-features` on optional_deps (1/2)
running `cargo check --no-default-features --features renemed` on optional_deps (2/2)
",
)
.assert_stderr_not_contains("--features real");
Expand Down