rust/book
Jason Newcomb 6cc8f8dbaa
Do not trigger inefficient_to_string after Rust 1.82 (#15729)
Starting with Rust version 1.82.0, the compiler generates similar code
with and without the `with_ref` cfg:

```rust
fn f(x: impl IntoIterator<Item = String>) {
    for y in x { println!("{y}"); }
}

fn main() {
    #[cfg(with_ref)]
    let a = ["foo", "bar"].iter().map(|&s| s.to_string());
    #[cfg(not(with_ref))]
    let a = ["foo", "bar"].iter().map(|s| s.to_string());
    f(a);
}
```

The generated code is strictly identical with `-O`, and identical modulo
some minor reordering without.

changelog: [`inefficient_to_string`]: do not trigger for Rust ≥ 1.82.0
2025-10-01 22:02:53 +00:00
..
src Do not trigger inefficient_to_string after Rust 1.82 (#15729) 2025-10-01 22:02:53 +00:00
book.toml Merge commit '51d49c1ae2' into clippy-subtree-update 2025-01-28 19:33:54 +01:00
README.md Merge commit 'fdb84cbfd2' into clippyup 2022-07-18 09:39:37 +02:00

Clippy Book

This is the source for the Clippy Book. See the book for more information.