Skip to content

Commit 688da45

Browse files
authored
build: Ignore missing features in tests crates (#1101)
Only the crate `tests-2015` uses the feature `edition-2015`, but the code is shared with the `tests` crate. Same for `tests-no-std` which disables feature `std`, but reuses the code with the `tests` crate. Therefore the `tests`, `tests-2018` and `tests-no-std` crates should be configured to ignore the lint about missing features. Cargo clippy reports: ``` warning: unexpected `cfg` condition value: `edition-2015` --> tests-no-std/../tests/src/build.rs:5:14 | 5 | if #[cfg(feature = "edition-2015")] { | ^^^^^^^----------------- | | | help: remove the condition | = note: no expected values for `feature` = help: consider adding `edition-2015` as a feature in `Cargo.toml` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default ```
1 parent a273108 commit 688da45

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

tests-2018/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ path = "../tests/src/lib.rs"
1818
default = ["std"]
1919
std = []
2020

21+
[lints.rust]
22+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("edition-2015"))'] }
23+
2124
[dependencies]
2225
anyhow = "1.0.1"
2326
bytes = "1"

tests-no-std/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ build = "../tests/src/build.rs"
1111
doctest = false
1212
path = "../tests/src/lib.rs"
1313

14+
[lints.rust]
15+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("edition-2015", "std"))'] }
16+
1417
# Compile the `tests` crate *without* the std feature, which is implicitly
1518
# omitted from the default crate features. It would be easier to do something
1619
# like `cargo test -p tests --no-default-features`, but that currently does not

tests/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ build = "src/build.rs"
1111
default = ["std"]
1212
std = []
1313

14+
[lints.rust]
15+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("edition-2015"))'] }
16+
1417
[dependencies]
1518
anyhow = "1.0.1"
1619
cfg-if = "1"

0 commit comments

Comments
 (0)