mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Mention size_hint()
effect in flat_map_option
lint documentation.
This commit is contained in:
parent
443f459f98
commit
15da6e735a
1 changed files with 6 additions and 2 deletions
|
@ -231,8 +231,12 @@ declare_clippy_lint! {
|
||||||
/// used instead.
|
/// used instead.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
/// When applicable, `filter_map()` is more clear since it shows that
|
/// `filter_map()` is known to always produce 0 or 1 output items per input item,
|
||||||
/// `Option` is used to produce 0 or 1 items.
|
/// rather than however many the inner iterator type produces.
|
||||||
|
/// Therefore, it maintains the upper bound in `Iterator::size_hint()`,
|
||||||
|
/// and communicates to the reader that the input items are not being expanded into
|
||||||
|
/// multiple output items without their having to notice that the mapping function
|
||||||
|
/// returns an `Option`.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
|
Loading…
Reference in a new issue