-
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
feels like a blanket ban of the FromIterator
trait
#7213
Comments
Previously: #6550. Let's say it's not a coincidence that I got involved in the prelude changes. Given that the RFC has been accepted, I do think it's time to make this allow by default. |
Congrats @djc on your success with appealing your case to the Supreme Court! 😉 I agree. This lint is founded on a style principle that is, well, going out of style. |
I think it would be better to fix the lint to only include cases where turbofish is not needed. Moving to pedantic doesn't really solve the issue here. |
What semantics do you suggest exactly? The lint should only trigger if the full destination type can be inferred? |
Right. |
I tried this code:
I expected to see this happen: no warning
Instead, this happened:
The
Vec::from_iter
call is much more succinct and readable than.collect::<Vec<_>>()
, and rust-lang/rfcs#3114 is currently in FCP-disposition-merge to addstd::iter::FromIterator
to the Rust 2021 prelude. Having Clippy recommend against using it seems to go against the decision there that it is a trait to be used directly.I'm really not sure if there's some subset of this lint that would feel ok, there's maybe some sort of "
collect
here would be more readable", but defining heuristics to detect when to enable that seems complicated.Meta
cargo clippy -V
:clippy 0.1.53 (42816d6 2021-04-24)
The text was updated successfully, but these errors were encountered: