Closed
Description
rust/src/libstd/io/buffered.rs
Line 451 in eeaf497
BufWriter
doesn't really need to hold its inner writer as an Option
; it seems like the only reason it does so is to make it easier to call into_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 in buffered.rs
, and it seems like the better choice here would be to use ptr::read
and mem::forget
, especially because this method is probably infrequently used, and making this change would remove the numerous unwrap
s that litter the BufWriter
implementation.