2 Checks for `find_map` calls that could be replaced by `find` or `map`. More
3 specifically it checks if the closure provided is only performing one of the
4 find or map operations and suggests the appropriate option.
7 Complexity. The intent is also clearer if only a single
8 operation is being performed.
12 let _ = (0..3).find_map(|x| if x > 2 { Some(x) } else { None });
14 // As there is no transformation of the argument this could be written as:
15 let _ = (0..3).find(|&x| x > 2);
19 let _ = (0..4).find_map(|x| Some(x + 1));
21 // As there is no conditional check on the argument this could be written as:
22 let _ = (0..4).map(|x| x + 1).next();