Cfg all vs mutitple cfg

I was today old when I realize it's possible to use multiple #[cfg] instead of #[cfg(all(...))].

And I wonder if you have a preference for one or the other and the reasons.

#[cfg(all(predicate1, predicate2))]
mod foo;
mod foo;

I would always use #[cfg(all(foo, bar))]. It looks cleaner and conveys the purpose more explicitly - multiple #[cfg]s could also mean any.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.