From Rust 1.88.0 onwards (releasing in late June 2025) you can just do #[cfg(true)] or #[cfg(false)]
See https://releases.rs/docs/1.88.0/ or https://github.com/rust-lang/rust/issues/131204