Auto merge of #109990 - gwy15:remove-bufwriter-useless-mut-pointer, r=jyn514

Remove an unnecessary `mut` in `BufWriter::into_parts`.

`ptr::read` takes `*const T` so `&mut` is not necessary.
This commit is contained in:
bors 2023-04-07 05:49:34 +00:00
commit 97879ce24b

View File

@ -339,7 +339,7 @@ impl<W: Write> BufWriter<W> {
let buf = if !self.panicked { Ok(buf) } else { Err(WriterPanicked { buf }) };
// SAFETY: forget(self) prevents double dropping inner
let inner = unsafe { ptr::read(&mut self.inner) };
let inner = unsafe { ptr::read(&self.inner) };
mem::forget(self);
(inner, buf)