-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
from_iter_instead_of_collect is too strict #6550
Comments
I believe |
I hit something similar with test code like |
From the Rust documentation, it is pretty clear that turbofish syntax is encouraged over using
and
|
This part was written in November 2015, back in Rust 1.6.0. rust-lang/rust@9d663a3
This part was written in October 2015, back in Rust 1.6.0 as well. rust-lang/rust@d91785a It is fair to say Rust practices have evolved since then, and it might be worth reconsidering. @steveklabnik wdyt? |
I also wanted to say it's a bit of a leap to say that turbofish is "encouraged". The first snippet just says "is rarely called", factually noting that I did also run a poll over on users.r-l.o which does show a substantial preference for collecting. On the other hand, three of the poll respondents who volunteered additional data on their usage each highlighted that they sometimes prefer |
A couple of intersecting things going on here, but in short, I am not sure I've ever seen I would personally maybe consider annotating |
Lint name:
from_iter_instead_of_collect
clippy is suggesting I make this change:
I don't think this is an improvement, because now I need to turbofish the return type including wildcard type arguments, which wasn't needed for the
from_iter()
call. If the return type could be inferred by the compiler, I'd agree, but I'm not sure how easy it is for clippy to determine that.(This is pretty similar to #6533, but with a different argument.)
Meta
cargo clippy -V
: clippy 0.0.212 (e1884a8e 2020-12-29)rustc -Vv
:The text was updated successfully, but these errors were encountered: