Implement fmt::Debug for all structures in libstd.

Part of https://github.com/rust-lang/rust/issues/31869.

Also turn on the `missing_debug_implementations` lint at the crate
level.
This commit is contained in:
Corey Farwell
2016-11-25 13:21:49 -05:00
parent 1f965cc8e9
commit 86fc63e62d
31 changed files with 515 additions and 7 deletions

View File

@@ -282,6 +282,13 @@ impl Stdin {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Stdin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Stdin { .. }")
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Read for Stdin {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
@@ -314,6 +321,13 @@ impl<'a> BufRead for StdinLock<'a> {
fn consume(&mut self, n: usize) { self.inner.consume(n) }
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl<'a> fmt::Debug for StdinLock<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("StdinLock { .. }")
}
}
/// A handle to the global standard output stream of the current process.
///
/// Each handle shares a global buffer of data to be written to the standard
@@ -424,6 +438,13 @@ impl Stdout {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Stdout {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Stdout { .. }")
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Stdout {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -449,6 +470,13 @@ impl<'a> Write for StdoutLock<'a> {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl<'a> fmt::Debug for StdoutLock<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("StdoutLock { .. }")
}
}
/// A handle to the standard error stream of a process.
///
/// For more information, see the [`io::stderr`] method.
@@ -545,6 +573,13 @@ impl Stderr {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Stderr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Stderr { .. }")
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Stderr {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
@@ -570,6 +605,13 @@ impl<'a> Write for StderrLock<'a> {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl<'a> fmt::Debug for StderrLock<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("StderrLock { .. }")
}
}
/// Resets the thread-local stderr handle to the specified writer
///
/// This will replace the current thread's stderr handle, returning the old