pub static MAP_UNIT_FN: &Lint
Expand description

The map_unit_fn lint checks for Iterator::map receive a callable that returns ().

§Example

fn foo(items: &mut Vec<u8>) {
    items.sort();
}

fn main() {
    let mut x: Vec<Vec<u8>> = vec![
        vec![0, 2, 1],
        vec![5, 4, 3],
    ];
    x.iter_mut().map(foo);
}

{{produces}}

§Explanation

Mapping to () is almost always a mistake.