-
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
x..(y+1) reads better as x...y #329
Comments
We will have to wait on rust #28237 implementation. |
Similarly, x...(y-1) reads better as x..y |
@frewsxcv You have to be careful with that; it only applies to integers. |
I have yet to see ranges over anything else but integers, so we may just bail on floats. OTOH I'm curious: What's the difference between |
The latter includes everything but |
I'm curious about the justification for making the |
So basically there are two things here, the Range struct and the Range iterator. They're implemented as the same, but as a struct it's useful for specifying ranges, and as an iterator it's ... an iterator. As far as iterators go there is no difference in the floating point thing. This will be true for most practical uses. As far as range-as-data goes, of course there is a difference, since it's now a set. However range-as-data doesn't seem to be a common pattern. |
I suspect this will change once someone implements a range set. |
Lint range_plus_one and range_minus_one (closes #329)
Once we have inclusive ranges (which won't be too long; the RFC has recently been accepted), I think we should advise people to use them.
Perhaps we could also check for
x...(y-1)
while we're at it.The text was updated successfully, but these errors were encountered: