-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Do not trigger inefficient_to_string
after Rust 1.82
#15729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not trigger inefficient_to_string
after Rust 1.82
#15729
Conversation
Lintcheck changes for 951d35e
This comment will be updated if you push new changes |
This was fixed in |
b48e9ea
to
0567bd5
Compare
inefficient_to_string
inefficient_to_string
after Rust 1.82
Code, description, and title updated to not trigger the lint starting from Rust 1.82.0. r? Jarcho since you suggested this |
cc @rust-lang/clippy I'll wait and see if anyone else has anything to say before merging. This is the opposite of how we use MSRV everywhere else, but it makes sense with how the lint is useless after a specific version. |
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.
0567bd5
to
951d35e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Starting with Rust version 1.82.0, the compiler generates similar code with and without the
with_ref
cfg:The generated code is strictly identical with
-O
, and identical modulosome minor reordering without.
changelog: [
inefficient_to_string
]: do not trigger for Rust ≥ 1.82.0