-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
array_chunks: remove Option wrapper from into_remainder's return type #148249
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
Conversation
This comment has been minimized.
This comment has been minimized.
5f78b4e to
78f5c2b
Compare
| while self.remainder.is_none() { | ||
| let _ = self.next(); | ||
| } | ||
| self.remainder | ||
| self.remainder.unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth restructuring this to avoid needing the unwrap?
I'm imagining something like
| while self.remainder.is_none() { | |
| let _ = self.next(); | |
| } | |
| self.remainder | |
| self.remainder.unwrap() | |
| loop { | |
| if let Some(r) = self.remainder { | |
| return r; | |
| } | |
| let _ = self.next(); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that is indeed equivalent it has the downside of the loop then being slightly more complicated, but let me know if you want it changed.
@rustbot ready
|
closing this since #149127 was merged. |
This simplifies
into_remainder's return type.