macro_rules! siaf { (|$($parm:ident),* $(,)*| $body:expr) => {{ /* ensure no captures */ let closure: fn($($parm: _),*)->_ = |$($parm),*| $body; (closure)($($parm),*) }} } fn compute_g(a: i32, b: i32, c: i32) -> i32 { let d = siaf!(|a, b| a + c); let (e, f) = siaf!(|d| (d - 1, d + 1)); let g = siaf!(|c, e, f| c + e + f ); g } fn main() { println!("{}", compute_g(1, 2, 3)); }