for_each_value_source in clippy_utils::visitors - Rust
Description: Runs the given function for each sub-expression producing the final value consumed by the parent of the give expression.

Skip to main content

## for_each_value_source

# Function for_each_value_source

Source

    pub fn for_each_value_source<'tcx, B>(
        e: &'tcx Expr<'tcx>,
        f: &mut impl FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>,
    ) -> ControlFlow<B>

Expand description

Runs the given function for each sub-expression producing the final value consumed by the parent of the give expression.

e.g. for the following expression

ⓘ

    if foo {
        f(0)
    } else {
        1 + 1
    }

this will pass both `f(0)` and `1+1` to the given function.