-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-unnecessaryLint: Warn about unnecessary codeLint: Warn about unnecessary codeT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
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.
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-unnecessaryLint: Warn about unnecessary codeLint: Warn about unnecessary codeT-middleType: Probably requires verifiying typesType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy