Remove an unnecessary mut in BufWriter::into_parts.

`ptr::read` takes `*const T` so `&mut` is not necessary.
This commit is contained in:
管唯宇 2023-04-06 11:48:16 +08:00
parent 8c7ad16e82
commit 9169107c1c

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)