1
Fork 0

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

@ -1444,6 +1444,16 @@ pub struct Chain<T, U> {
done_first: bool,
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Chain")
.field("t", &self.first)
.field("u", &self.second)
.finish()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Read, U: Read> Read for Chain<T, U> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
@ -1485,6 +1495,7 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
///
/// [`take()`]: trait.Read.html#method.take
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Take<T> {
inner: T,
limit: u64,
@ -1602,6 +1613,7 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
///
/// [`bytes()`]: trait.Read.html#method.bytes
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Bytes<R> {
inner: R,
}
@ -1623,6 +1635,7 @@ impl<R: Read> Iterator for Bytes<R> {
/// [chars]: trait.Read.html#method.chars
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
issue = "27802")]
#[derive(Debug)]
pub struct Chars<R> {
inner: R,
}
@ -1712,6 +1725,7 @@ impl fmt::Display for CharsError {
///
/// [split]: trait.BufRead.html#method.split
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Split<B> {
buf: B,
delim: u8,
@ -1743,6 +1757,7 @@ impl<B: BufRead> Iterator for Split<B> {
///
/// [lines]: trait.BufRead.html#method.lines
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)]
pub struct Lines<B> {
buf: B,
}