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

@@ -10,6 +10,7 @@
#![allow(missing_copy_implementations)]
use fmt;
use io::{self, Read, Write, ErrorKind, BufRead};
/// Copies the entire contents of a reader into a writer.
@@ -97,6 +98,13 @@ impl BufRead for Empty {
fn consume(&mut self, _n: usize) {}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Empty {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Empty { .. }")
}
}
/// A reader which yields one byte over and over and over and over and over and...
///
/// This struct is generally created by calling [`repeat()`][repeat]. Please
@@ -133,6 +141,13 @@ impl Read for Repeat {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Repeat { .. }")
}
}
/// A writer which will move data into the void.
///
/// This struct is generally created by calling [`sink()`][sink]. Please
@@ -165,6 +180,13 @@ impl Write for Sink {
fn flush(&mut self) -> io::Result<()> { Ok(()) }
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Sink {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Sink { .. }")
}
}
#[cfg(test)]
mod tests {
use io::prelude::*;