# Function clippy_utils::walk_to_expr_usage

source ·

    pub fn walk_to_expr_usage<'tcx, T>(
        cx: &LateContext<'tcx>,
        e: &Expr<'tcx>,
        f: impl FnMut(Node<'tcx>, HirId) -> Option<T>
    ) -> Option<T>

Expand description

Walks the HIR tree from the given expression, up to the node where the value produced by the expression is consumed. Calls the function for every node encountered this way until it returns `Some`.

This allows walking through `if`, `match`, `break`, block expressions to find where the value produced by the expression is consumed.