With the C pre-processor it's common to do,
#if defined(NDEBUG)
// release build
#endif
#if defined(DEBUG)
// debug build
#endif
Cargo's rough equivalents are:
cargo build --release
for release.cargo build
for debug.
How would Rust's #[cfg(...)]
attribute or cfg!(...)
macro be used to do something similar?
I understand that Rust's pre-processor doesn't work like C's. I checked the documentation and this page lists some attributes. (assuming this list is comprehensive)
debug_assertions
could be checked, but it may be misleading when used to check for the more general debugging case.
I'm not sure if this question should be related to Cargo or not.