rust-lang / cfg-if

A if/elif-like macro for Rust #[cfg] statements
Apache License 2.0
557 stars 40 forks source link

Allow blocks without else. #4

Closed clarfonthey closed 7 years ago

clarfonthey commented 7 years ago

It doesn't seem immediately obvious from the documentation that you can't do a block without an else branch, so, I added that functionality.

alexcrichton commented 7 years ago

Out of curiosity, do you have a use case for this? This was originally intentional because I'd consider it bad practice to not have a fallback

clarfonthey commented 7 years ago

I mean, I make pretty extensive use of it in len-trait and it seems excessive to have to add else {} everywhere.

alexcrichton commented 7 years ago

Ah ok, that seems reasonable!

clarfonthey commented 7 years ago

Would you be willing to push another version to crates.io for this?

alexcrichton commented 7 years ago

Sure, published