fn consumes_all(iter: &Iter) -> bool {
    if let Iter {
        start: None,
        end: None,
        stride: None,
        ..
    } = *iter
    {
        return true;
    } else if let Iter {
        ref data,
        start: Some(ref start),
        end: Some(ref end),
        stride: Some(ref stride),
        ..
    } = *iter
    {
        // Checks if the stride is 1 and an entire vector represented by a symbol is consumed.
        if let (
            &Literal(I64Literal(1)),
            &Literal(I64Literal(0)),
            &Ident(ref name),
            &Length { data: ref v },
        ) = (&stride.kind, &start.kind, &data.kind, &end.kind)
        {
            if let Ident(ref vsym) = v.kind {
                return vsym == name;
            }
        }
        // Checks if an entire vector literal is consumed.
        if let (&Literal(I64Literal(1)), &Literal(I64Literal(0)), &MakeVector { ref elems }) =
            (&stride.kind, &start.kind, &data.kind)
        {
            let num_elems = elems.len() as i64;
            if let Literal(I64Literal(x)) = end.kind {
                return num_elems == x;
            }
        }
    }
    false
}
Given an iterator, returns whether the iterator consumes every element of its data vector.
weld/src/optimizer/transforms/loop_fusion.rs