Compiler optimization suggestion - Iter<String>.collect::<Vec<String>>().join("")
#95165
Labels
S-inactive
Status: Inactive and waiting on the author. This is often applied to closed PRs.
Hi,
I've opened this issue for
clippy
: rust-lang/rust-clippy#8570 wherein acollect::<Vec<String>>().join("")
operation on anIter<String>
can be expressed ascollect::<String>()
which is more performant.I wanted to put this here as well as I think this may be something that can also be optimized by the compiler (by replacing the former with the latter) since the output should always be equivalent and the latter option is more performant.
See cases of this happening in the wild here (GitHub CS Beta) or here (Sourcegraph)
I'm learning Rust so please let me know if I'm missing something, thank you!
The text was updated successfully, but these errors were encountered: