Skip to content

array_chunks: remove Option wrapper from into_remainder's return type - #148249

Closed
hkBst wants to merge 1 commit into
rust-lang:mainfrom
hkBst:array-chunks1
Closed

array_chunks: remove Option wrapper from into_remainder's return type#148249
hkBst wants to merge 1 commit into
rust-lang:mainfrom
hkBst:array-chunks1

Conversation

@hkBst

Copy link
Copy Markdown
Member

This simplifies into_remainder's return type.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 29, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

Comment on lines +50 to +53
while self.remainder.is_none() {
let _ = self.next();
}
self.remainder
self.remainder.unwrap()

Copy link
Copy Markdown
Member

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

Suggested change
whileself.remainder.is_none(){
let _ = self.next();
}
self.remainder
self.remainder.unwrap()
loop{
ifletSome(r) = self.remainder{
return r;
}
let _ = self.next();
}

Copy link
Copy Markdown
MemberAuthor

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

@scottmcmscottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 17, 2025
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 17, 2025
@WaffleLapkin

Copy link
Copy Markdown
Member

closing this since #149127 was merged.

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 21, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@hkBst@rustbot@rust-log-analyzer@WaffleLapkin@scottmcm