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;
#[cfg(predicate1)]
#[cfg(predicate2)]
mod foo;
leob
2
I would always use #[cfg(all(foo, bar))]
. It looks cleaner and conveys the purpose more explicitly - multiple #[cfg]
s could also mean any
.
5 Likes
system
Closed
3
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.