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

@ -114,6 +114,17 @@ impl IntoInner<imp::Process> for Child {
fn into_inner(self) -> imp::Process { self.handle }
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Child {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Child")
.field("stdin", &self.stdin)
.field("stdout", &self.stdout)
.field("stderr", &self.stderr)
.finish()
}
}
/// A handle to a child process's stdin. This struct is used in the [`stdin`]
/// field on [`Child`].
///
@ -149,6 +160,13 @@ impl FromInner<AnonPipe> for ChildStdin {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for ChildStdin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("ChildStdin { .. }")
}
}
/// A handle to a child process's stdout. This struct is used in the [`stdout`]
/// field on [`Child`].
///
@ -183,6 +201,13 @@ impl FromInner<AnonPipe> for ChildStdout {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for ChildStdout {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("ChildStdout { .. }")
}
}
/// A handle to a child process's stderr. This struct is used in the [`stderr`]
/// field on [`Child`].
///
@ -217,6 +242,13 @@ impl FromInner<AnonPipe> for ChildStderr {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for ChildStderr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("ChildStderr { .. }")
}
}
/// A process builder, providing fine-grained control
/// over how a new process should be spawned.
///
@ -622,6 +654,13 @@ impl FromInner<imp::Stdio> for Stdio {
}
}
#[stable(feature = "std_debug", since = "1.15.0")]
impl fmt::Debug for Stdio {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad("Stdio { .. }")
}
}
/// Describes the result of a process after it has terminated.
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[stable(feature = "process", since = "1.0.0")]