Skip to content

Replace cfg(all())/cfg(any()) with cfg(true)/cfg(false) - #995

Merged
jonasbb merged 1 commit into
masterfrom
cfg-boolean
Aug 9, 2026
Merged

Replace cfg(all())/cfg(any()) with cfg(true)/cfg(false)#995
jonasbb merged 1 commit into
masterfrom
cfg-boolean

Conversation

@jonasbb

@jonasbb jonasbb commented Aug 9, 2026

Copy link
Copy Markdown
Owner

This makes the meaning clearer and is supported since Rust 1.88.

Ensure that serde_as knows how to deal with cfg(true)/cfg(false). For the schemars support it can understand cfg_attr and thus needs to parse true/false as well. This is not covered by the syn::Meta type, so we need to add a new type CfgAttrCondition that can represent true/false as well as the generic Meta expression.

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.91%. Comparing base (a43f246) to head (d0746be).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
serde_with_macros/src/utils.rs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #995      +/-   ##
==========================================
+ Coverage   68.88%   68.91%   +0.03%     
==========================================
  Files          38       38              
  Lines        9766     9777      +11     
==========================================
+ Hits         6727     6738      +11     
  Misses       3039     3039              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonasbb jonasbb changed the title Replace cfg(all())/cfg(any()) with cfg(true)/cfg(false)` Replace cfg(all())/cfg(any()) with cfg(true)/cfg(false) Aug 9, 2026
@jonasbb
jonasbb force-pushed the cfg-boolean branch 2 times, most recently from 8c8d0d4 to 1daa9fa Compare August 9, 2026 21:10
This makes the meaning clearer and is supported since Rust 1.88.

Ensure that `serde_as` knows how to deal with `cfg(true)`/`cfg(false)`.
For the `schemars` support it can understand `cfg_attr` and thus needs
to parse `true`/`false` as well. This is not covered by the `syn::Meta`
type, so we need to add a new type `CfgAttrCondition` that can represent
`true`/`false` as well as the generic `Meta` expression.
@jonasbb
jonasbb merged commit c8f2c00 into master Aug 9, 2026
25 checks passed
@jonasbb
jonasbb deleted the cfg-boolean branch August 9, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant