Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use cfg-if! macro to clarify conditional compilation sections #126

Closed
wants to merge 4 commits into from

Conversation

cosmicexplorer
Copy link
Contributor

As noted in #125 (comment), the cfg-if crate can be helpful for complex conditional compilation (like that introduced in #125). I believe I had made this change in the previous zip repo, but hadn't pushed it. This should produce no change in compiled output compared to the previous #[cfg(...)] { ... } blocks.

@cosmicexplorer
Copy link
Contributor Author

@Pr0methean the first two commits are from #125 so this can compile correctly, I will remove them once that is merged.

src/read.rs Dismissed Show dismissed Hide dismissed
@Pr0methean
Copy link
Member

Pr0methean commented May 15, 2024

As I see it, this doesn't improve readability at all, just adds more lines and an extra level of nesting -- an unacceptable price to pay IMO for de-duplicating between #[cfg(x)] and #[cfg(not(x))]. That said, I'll look for places where I can switch to the cfg! macro without causing invalid imports to be parsed.

@Pr0methean Pr0methean closed this May 15, 2024
@Pr0methean
Copy link
Member

Managed to eliminate a few #[cfg] attributes in 819f865

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.

2 participants