(RFC) remove the Times trait in favour of range - #8371
Conversation
|
I don't see how to special case the for loop syntax. It has to decide whether to parse the tokens after "for" as pattern or expr. How should it choose? |
|
That's true, it's not as simple as I expected due to the need to avoid boundless lookahead. I guess that's the cost of putting the pattern first. Whether or not we can make a short form, I still think we should be using |
|
I've already registered my arguments against this in the comments on #8326. To reiterate the most important points:
Even before external iterators we'd had the ability to do
To repeat, I'm fine with removing all uses of |
|
This is a tough call for me. My gut tells me to not like With If we do keep it, then I think it should stay in the prelude - as a convenience method it's much less convenient to require an import. |
|
I find it less convenient, because you have no An alternative is |
|
I doubt that I've ever tried to break out of or return from |
|
The Every single function/method/trait/type in the library is a burden, because it makes the language more complex. I don't think |
It's not possible to break from `times` and it results in the restrictions coming from closures. Using `for _ in range(0, n)` from the start is simpler, rather than switching to it after hitting either of these issues.
|
I want to solicit other opinions. |
|
Can |
|
If we made a trait for unsigned integers, it could be implemented from that. |
|
What about dropping the trait and just having |
|
Closing due to lack of activity. Feel free to open a new pull request if consensus gets reached on this! |
8371: Don't use HirDisplayWrapper when displaying SourceCode r=matklad a=Veykril The issue was basically that when displaying for `DisplayTarget::SourceCode` some `hir_fmt` functions would create `HirDisplayWrapper`s which would then `fmt` these triggering the Display panic since `fmt::Display` can't fail the same way as `HirDisplay`. Simple fix is to just use `hir_fmt` directly. Should probably write that down somewhere in source, looking for a good spot to put that right now. Fixes rust-lang#8077, Fixes rust-lang#8370 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
It's not possible to break from
timesand it results in therestrictions coming from closures. Using
for _ in range(0, n)from thestart is simpler, rather than switching to it after hitting either of
these issues.