fn inline_let_helper(expr: &mut Expr, usages: &mut FnvHashMap<Symbol, SymbolTracker>) {
    let mut taken_body = None;
    match expr.kind {
        Let {
            ref mut name,
            ref mut value,
            ref mut body,
        } => {
            // Check whether the symbol is used one or fewer times.
            if let Some(tracker) = usages.get_mut(name) {
                if tracker.count <= 1 {
                    taken_body = Some(body.take());
                    tracker.value = Some(value.take());
                }
            }
        }
        Ident(ref name) => {
            // Check if the identifier maps to one that should be inlined.
            if let Some(tracker) = usages.get_mut(name) {
                if tracker.count <= 1 {
                    // Value should have been set by a preceding Let.
                    debug_assert!(tracker.value.is_some());
                    // Value should only be swapped once.
                    debug_assert!(!tracker.value.as_ref().unwrap().is_placeholder());
                    mem::swap(&mut taken_body, &mut tracker.value);
                }
            }
        }
        _ => (),
    }

    // Set the body to this expression.
    if let Some(mut val) = taken_body {
        mem::swap(expr, val.as_mut());
        inline_let_helper(expr, usages);
    } else {
        for child in expr.children_mut() {
            inline_let_helper(child, usages);
        }
    }
}
Inlines Let calls if the symbol defined by the Let statement is used
never or only one time.
weld/src/optimizer/transforms/inliner.rs