Skip to content

Use slice::fill in io::Repeat implementation - #136967

Merged
bors merged 1 commit into
rust-lang:masterfrom
DaniPopes:io-repeat-fill
Feb 14, 2025
Merged

bors merged 1 commit into
rust-lang:masterfrom
DaniPopes:io-repeat-fill

Conversation

@DaniPopes

Copy link
Copy Markdown
Contributor

Use the existing fill methods on slices instead of manually writing the fill loop.

@rustbot

ghost commented Feb 13, 2025

Copy link
Copy Markdown
Collaborator

r? @tgross35

rustbot has assigned @tgross35.
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

@rustbot rustbot 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 Feb 13, 2025

ghost left a comment

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.

Great idea! Just one nit, then r=me

Comment thread library/std/src/io/util.rs Outdated
}

// SAFETY: No uninit bytes are being written.
crate::mem::MaybeUninit::fill(unsafe { buf.as_mut() }, self.byte);

ghost Feb 13, 2025

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.

I'm not a big fan of long paths... could you use MaybeUninit instead?

@joboet joboet assigned joboet and unassigned tgross35 Feb 13, 2025
Use the existing `fill` methods on slices instead of manually
writing the fill loop.
@joboet

ghost commented Feb 13, 2025

Copy link
Copy Markdown
Member

Thank you!
@bors r+

@bors

ghost commented Feb 13, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 1a3efd2 has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2025
@bors
bors merged commit b5fce2a into rust-lang:master Feb 14, 2025
@rustbot rustbot added this to the 1.86.0 milestone Feb 14, 2025
@DaniPopes
DaniPopes deleted the io-repeat-fill branch February 14, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant 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