diff options
| author | 管唯宇 <guanweiyu.b@bytedance.com> | 2023-04-06 11:48:16 +0800 |
|---|---|---|
| committer | 管唯宇 <guanweiyu.b@bytedance.com> | 2023-04-06 11:48:16 +0800 |
| commit | 9169107c1cf15bc955bb15a06d83a1ebf011e9eb (patch) | |
| tree | 2d9d67af4bb4d7c6d77d7d24dc667bb3e66a7708 | |
| parent | 8c7ad16e82dd19ea03b19d78a02a815f2f138db5 (diff) | |
| download | rust-9169107c1cf15bc955bb15a06d83a1ebf011e9eb.tar.gz rust-9169107c1cf15bc955bb15a06d83a1ebf011e9eb.zip | |
Remove an unnecessary `mut` in `BufWriter::into_parts`.
`ptr::read` takes `*const T` so `&mut` is not necessary.
| -rw-r--r-- | library/std/src/io/buffered/bufwriter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs index 6acb937e784..14c455d4fa3 100644 --- a/library/std/src/io/buffered/bufwriter.rs +++ b/library/std/src/io/buffered/bufwriter.rs @@ -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) |
