Skip to content

Commit 405fdb4

Browse files
authored
Merge pull request #627 from Thomasdezeeuw/check-features
Check usage of max_level features
2 parents 28d734b + 710560e commit 405fdb4

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
rustup default ${{ matrix.rust }}
4242
- run: cargo test --verbose
4343
- run: cargo test --verbose --no-default-features
44-
- run: cargo test --verbose --all-features
44+
- run: cargo test --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde
4545
- run: cargo test --verbose --features serde
4646
- run: cargo test --verbose --features std
4747
- run: cargo test --verbose --features kv
@@ -92,7 +92,7 @@ jobs:
9292
rustup default stable
9393
rustup component add rust-docs
9494
- name: Run rustdoc
95-
run: RUSTDOCFLAGS="-D warnings" cargo doc --verbose --all-features
95+
run: RUSTDOCFLAGS="-D warnings" cargo doc --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde
9696

9797
features:
9898
name: Feature check

src/lib.rs

+39
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,45 @@
346346
#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
347347
#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))]
348348

349+
#[cfg(any(
350+
all(feature = "max_level_off", feature = "max_level_error"),
351+
all(feature = "max_level_off", feature = "max_level_warn"),
352+
all(feature = "max_level_off", feature = "max_level_info"),
353+
all(feature = "max_level_off", feature = "max_level_debug"),
354+
all(feature = "max_level_off", feature = "max_level_trace"),
355+
all(feature = "max_level_error", feature = "max_level_warn"),
356+
all(feature = "max_level_error", feature = "max_level_info"),
357+
all(feature = "max_level_error", feature = "max_level_debug"),
358+
all(feature = "max_level_error", feature = "max_level_trace"),
359+
all(feature = "max_level_warn", feature = "max_level_info"),
360+
all(feature = "max_level_warn", feature = "max_level_debug"),
361+
all(feature = "max_level_warn", feature = "max_level_trace"),
362+
all(feature = "max_level_info", feature = "max_level_debug"),
363+
all(feature = "max_level_info", feature = "max_level_trace"),
364+
all(feature = "max_level_debug", feature = "max_level_trace"),
365+
))]
366+
compile_error!("multiple max_level_* features set");
367+
368+
#[rustfmt::skip]
369+
#[cfg(any(
370+
all(feature = "release_max_level_off", feature = "release_max_level_error"),
371+
all(feature = "release_max_level_off", feature = "release_max_level_warn"),
372+
all(feature = "release_max_level_off", feature = "release_max_level_info"),
373+
all(feature = "release_max_level_off", feature = "release_max_level_debug"),
374+
all(feature = "release_max_level_off", feature = "release_max_level_trace"),
375+
all(feature = "release_max_level_error", feature = "release_max_level_warn"),
376+
all(feature = "release_max_level_error", feature = "release_max_level_info"),
377+
all(feature = "release_max_level_error", feature = "release_max_level_debug"),
378+
all(feature = "release_max_level_error", feature = "release_max_level_trace"),
379+
all(feature = "release_max_level_warn", feature = "release_max_level_info"),
380+
all(feature = "release_max_level_warn", feature = "release_max_level_debug"),
381+
all(feature = "release_max_level_warn", feature = "release_max_level_trace"),
382+
all(feature = "release_max_level_info", feature = "release_max_level_debug"),
383+
all(feature = "release_max_level_info", feature = "release_max_level_trace"),
384+
all(feature = "release_max_level_debug", feature = "release_max_level_trace"),
385+
))]
386+
compile_error!("multiple release_max_level_* features set");
387+
349388
#[cfg(all(not(feature = "std"), not(test)))]
350389
extern crate core as std;
351390

0 commit comments

Comments
 (0)