Closed
Description
filter_map
is a more specific version of flat_map
. It would be neat if Clippy recommended using filter_map
instead of flat_map
when the function in flat_map
returns Option
.
This is an example from documentation with filter_map
replaced by flat_map
.
fn main() {
let a = ["1", "2", "lol"];
let mut iter = a.iter().flat_map(|s| s.parse().ok());
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), None);
}
it would be more readable with filter_map
instead of flat_map
.