Closed peng1999 closed 5 years ago
Perhaps! I have no idea how to structure the macro to do that, but if it can be done then it could perhaps be done
This would be really useful for me, where I'm wanting to do something like:
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function to get better error messages if we ever panic.
if #[cfg(feature = "console_error_panic_hook")] {
extern crate console_error_panic_hook;
use console_error_panic_hook::set_once as set_panic_hook;
} else {
#[inline]
fn set_panic_hook() {}
}
}
}
I'm going to close this because, while convenient, I don't think it's very easily supported in the macro and would prefer to not overly complicate the macro too much. If others want to maintain this on crates.io, though, that's totally fine!
Allowing nested if-statment can reduce indent level:
Is that reasonable?