rust/clippy_lints
bors 403433f2f7 Auto merge of #12526 - kpreid:patch-2, r=blyxyas
Mention `size_hint()` effect in `flat_map_option` lint documentation.

The previous documentation for `flat_map_option` mentioned only readability benefits, but there is also at least one performance benefit: the `size_hint()` upper bound is preserved, whereas `flat_map().size_hint()` is always `(0, None)`.

Program demonstrating this difference:

```rust
fn main() {
    let evens = |i| if i % 2 == 0 { Some(i) } else { None };

    dbg!(
        [1, 2, 3].iter().flat_map(evens).size_hint(),
        [1, 2, 3].iter().filter_map(evens).size_hint(),
    );
}
```

changelog: [`flat_map_option`]: Mention the benefit to `size_hint()`.
2024-03-22 13:09:28 +00:00
..
src Auto merge of #12526 - kpreid:patch-2, r=blyxyas 2024-03-22 13:09:28 +00:00
Cargo.toml Bump Clippy version -> 0.1.79 2024-03-21 22:06:41 +01:00
README.md

This crate contains Clippy lints. For the main crate, check GitHub.