-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Remove Option<W> in BufWriter #72925
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
rust/src/libstd/io/buffered.rs
Line 451 in eeaf497
BufWriterdoesn't really need to hold its inner writer as anOption; it seems like the only reason it does so is to make it easier to callinto_inner, here:rust/src/libstd/io/buffered.rs
Lines 648 to 653 in eeaf497
While it's unfortunate to add
unsafe, there's already some inbuffered.rs, and it seems like the better choice here would be to useptr::readandmem::forget, especially because this method is probably infrequently used, and making this change would remove the numerousunwraps that litter theBufWriterimplementation.