-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Minor cleanups now that #9629 is fixed #10930
Conversation
Ug. Looks like it opened this a little bit early since I just realized that this won't work until the next snapshot. I will rebase this when the next snapshot is made. |
Hopefully soon! (#10919) |
The behavior of the |
This field is no longer necessary now that rust-lang#9629 is fixed since we can just access the length of the remaining slice directly.
Update the next() method to just return self.v in the case that we've reached the last element that the iterator will yield. This produces equivalent behavior as before, but without the cost of updating the field. Update the size_hint() method to return a better hint now that rust-lang#9629 is fixed.
The merge failed since there was an unused variable which I missed removing. I've rebased to get rid of that variable which should fix that issue. |
…crichton 3 minor clean-ups now that #9629 is fixed: * Update MutChunkIter to remove the ```remainder``` that existed just to allow the size_hint() method to be implemented. This is no longer necessary since we can just access the length of the slice directly. * Update MutSplitIterator to address the FIXME in its size_hint() method. This method was only partially implemented due to the issue. Also, implement a minor optimization in the case that its the last iteration. * Update ByRef iterator to implement the size_hint() method. I noticed that MutSplitIterator returns an empty slice if called on an empty slice. I don't know if this is intended or not, but I left the ```finished``` field in-place to preserve this behavior. @TeXitoi @blake2-ppc
[`redundant_closure_call`]: handle nested closures Fixes rust-lang#9956. This ended up being a much larger change than I'd thought, and I ended up having to pretty much rewrite it as a late lint pass, because it needs access to certain things that I don't think are available in early lint passes (e.g. getting the parent expr). I think this'll be required to fi-x rust-lang#10922 anyway, so this is probably fine. (edit: had to write "fi-x" because "fix" makes github think that this PR fixes it, which it doesn't 😅 ) Previously, it would suggest changing `(|| || 42)()()` to `|| 42()`, which is a type error (it needs parens: `(|| 42)()`). In my opinion, though, the suggested fix should have really been `42`, so that's what this PR changes. changelog: [`redundant_closure_call`]: handle nested closures and rewrite as a late lint pass
3 minor clean-ups now that #9629 is fixed:
remainder
that existed just to allow the size_hint() method to be implemented. This is no longer necessary since we can just access the length of the slice directly.I noticed that MutSplitIterator returns an empty slice if called on an empty slice. I don't know if this is intended or not, but I left the
finished
field in-place to preserve this behavior.@TeXitoi @blake2-ppc