We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
size_hint()
flat_map_option
1 parent 443f459 commit 15da6e7Copy full SHA for 15da6e7
clippy_lints/src/methods/mod.rs
@@ -231,8 +231,12 @@ declare_clippy_lint! {
231
/// used instead.
232
///
233
/// ### Why is this bad?
234
- /// When applicable, `filter_map()` is more clear since it shows that
235
- /// `Option` is used to produce 0 or 1 items.
+ /// `filter_map()` is known to always produce 0 or 1 output items per input item,
+ /// rather than however many the inner iterator type produces.
236
+ /// Therefore, it maintains the upper bound in `Iterator::size_hint()`,
237
+ /// and communicates to the reader that the input items are not being expanded into
238
+ /// multiple output items without their having to notice that the mapping function
239
+ /// returns an `Option`.
240
241
/// ### Example
242
/// ```no_run
0 commit comments