When porting code from another language, I would like to save some expressions, such as macros likely/ unlikelyas a dummy macro.
Usage example:
if expr_nop!(expression) {
code;
}
... which should be exactly the same as the entry:
if (expression) {
code;
}
What is a good fail-safe macro in rust that can be used as a no-op?
I currently have:
macro_rules! expr_nop { ($body:expr) => { $body } }
Is this correct or should it be written differently?
source
share