Skip to content

Commit

Permalink
Deduplicates io::Write implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoPonzi committed Sep 11, 2020
1 parent 28db521 commit ec7f9b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions library/std/src/io/stdio.rs
Expand Up @@ -584,26 +584,26 @@ impl fmt::Debug for Stdout {
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Stdout {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.lock().write(buf)
(&*self).write(buf)
}
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
self.lock().write_vectored(bufs)
(&*self).write_vectored(bufs)
}
#[inline]
fn is_write_vectored(&self) -> bool {
self.lock().is_write_vectored()
io::Write::is_write_vectored(&&*self)
}
fn flush(&mut self) -> io::Result<()> {
self.lock().flush()
(&*self).flush()
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.lock().write_all(buf)
(&*self).write_all(buf)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.lock().write_all_vectored(bufs)
(&*self).write_all_vectored(bufs)
}
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
(&*self).write_fmt(args)
}
}

Expand Down Expand Up @@ -787,26 +787,26 @@ impl fmt::Debug for Stderr {
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Stderr {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.lock().write(buf)
(&*self).write(buf)
}
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
self.lock().write_vectored(bufs)
(&*self).write_vectored(bufs)
}
#[inline]
fn is_write_vectored(&self) -> bool {
self.lock().is_write_vectored()
io::Write::is_write_vectored(&&*self)
}
fn flush(&mut self) -> io::Result<()> {
self.lock().flush()
(&*self).flush()
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.lock().write_all(buf)
(&*self).write_all(buf)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.lock().write_all_vectored(bufs)
(&*self).write_all_vectored(bufs)
}
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
(&*self).write_fmt(args)
}
}

Expand Down
8 changes: 4 additions & 4 deletions library/std/src/process.rs
Expand Up @@ -246,19 +246,19 @@ pub struct ChildStdin {
#[stable(feature = "process", since = "1.0.0")]
impl Write for ChildStdin {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.inner.write(buf)
(&*self).write(buf)
}

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
self.inner.write_vectored(bufs)
(&*self).write_vectored(bufs)
}

fn is_write_vectored(&self) -> bool {
self.inner.is_write_vectored()
io::Write::is_write_vectored(&&*self)
}

fn flush(&mut self) -> io::Result<()> {
Ok(())
(&*self).flush()
}
}

Expand Down

0 comments on commit ec7f9b9

Please sign in to comment.