Skip to content

Conversation

@rami3l
Copy link
Member

@rami3l rami3l commented May 16, 2024

It occurred to me right after #3811 that we actually have cfg_if in our imports, so using it more should provide better ergonomics and prevent issues like #3811 happen again (i.e. "I forgot to add #[cfg()] to some constructs but not others").

I plan to adjust #3803 to use cfg_if!{} in rustup-init.rs as well, where we also tend to use quite a lot of conditionally compiled constructs.

@rami3l rami3l requested a review from djc May 16, 2024 02:03
@djc
Copy link
Contributor

djc commented May 16, 2024

A simpler way of doing this would be to just move all the test-gated implementations into an inline module which is guarded with #[cfg(feature = "test")] and a single use statement that exports from the inline module. I think I'd prefer that over the cfg_if!{} approach, which is less standard and noisier.

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.

3 participants