-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a loop-iterator for option (suggest better names) #2927
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The naming of |
Oh, I see, your version of |
Yeah, I was looking at chain, too. Chain only recurses once, though - the point of this is to enable writing loops. I wanted to call it chain more than I want to call it iterate; do suggest better names if you can think of any. |
|
It's not as snappy... maybe I'd say change |
Register redundant_field_names and non_expressive_names as early passes Similar names was moved to a pre-expansion pass to solve rust-lang#2927, so I'm avoiding linting on code from expansion, which makes the dogfood (mostly, see below) pass. I had to change new_without_default though, and although I understand why it was not triggering before, TBH I don't see why the binding inside the nested `if_chain` is being linted now. Any ideas? (it seems legit though as the code can be changed by the user) changelog: Register redundant_field_names and non_expressive_names as early passes Fixes rust-lang#5356 Fixes rust-lang#5521
I found myself wanting this a lot during ICFP (#2928):
(It would have to be written non-tail-recursively, for non-optimised builds to be able to infinite loop with it, but the tail recursive way is so much prettier.)
As it is,
option::iter
is just a special case ofoption::map
where the return type of the block is unit. No need for it to be a different function.The text was updated successfully, but these errors were encountered: