-
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
for x in y { if x.something() { z }} should be for x in y.filter(|x| !x.something()) { z } #678
Comments
This is too subjective to make it |
allow is fine by me |
Yeah, it's less readable IMHO. |
I’m not sure I would want that by default either. |
If we suggest for x in y.iter().filter(…) {
stuff(x);
} we might as well suggest itertool's foreach because it reads nicer: y.iter().filter(…).foreach(stuff); (Another option would of course be to write let y = y.iter().filter(…);
for x in &y {
stuff(x);
} but that just seems to split the logic.) |
A recent thread on internals suggests that different versions of zips that should do the same thing exhibit differing performance characteristics, so we should tread lightly here until they have this figured out. I personally like |
I agree that this is not a good idea. |
encountered in the wild: https://github.com/Manishearth/rust-clippy/issues/600#issuecomment-184735383
and
should be
The text was updated successfully, but these errors were encountered: