Replace all fmt.pad with debug_struct

This commit is contained in:
Christiaan Dirkx 2021-04-05 13:31:11 +02:00
parent 62652865b6
commit 1fb3256fcb
21 changed files with 40 additions and 40 deletions

View file

@ -141,7 +141,7 @@ impl<T: 'static + ?Sized> Any for T {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for dyn Any {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish()
}
}
@ -151,14 +151,14 @@ impl fmt::Debug for dyn Any {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for dyn Any + Send {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish()
}
}
#[stable(feature = "any_send_sync_methods", since = "1.28.0")]
impl fmt::Debug for dyn Any + Send + Sync {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Any")
f.debug_struct("Any").finish()
}
}

View file

@ -145,6 +145,6 @@ impl fmt::Display for EscapeDefault {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for EscapeDefault {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EscapeDefault { .. }")
f.debug_struct("EscapeDefault").finish_non_exhaustive()
}
}

View file

@ -53,7 +53,7 @@ pub enum c_void {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for c_void {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("c_void")
f.debug_struct("c_void").finish()
}
}

View file

@ -2220,7 +2220,7 @@ impl Debug for () {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> Debug for PhantomData<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
f.pad("PhantomData")
f.debug_struct("PhantomData").finish()
}
}
@ -2270,7 +2270,7 @@ impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
#[stable(feature = "core_impl_debug", since = "1.9.0")]
impl<T: ?Sized> Debug for UnsafeCell<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
f.pad("UnsafeCell")
f.debug_struct("UnsafeCell").finish()
}
}

View file

@ -507,7 +507,7 @@ pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
#[stable(since = "1.9.0", feature = "core_impl_debug")]
impl<H> fmt::Debug for BuildHasherDefault<H> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("BuildHasherDefault")
f.debug_struct("BuildHasherDefault").finish()
}
}

View file

@ -36,7 +36,7 @@ unsafe impl<T> Sync for Empty<T> {}
#[stable(feature = "core_impl_debug", since = "1.9.0")]
impl<T> fmt::Debug for Empty<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Empty")
f.debug_struct("Empty").finish()
}
}

View file

@ -146,7 +146,7 @@ impl<'a> fmt::Display for EscapeAscii<'a> {
#[unstable(feature = "inherent_ascii_escape", issue = "77174")]
impl<'a> fmt::Debug for EscapeAscii<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EscapeAscii { .. }")
f.debug_struct("EscapeAscii").finish_non_exhaustive()
}
}

View file

@ -1359,7 +1359,7 @@ pub struct EncodeUtf16<'a> {
#[stable(feature = "collection_debug", since = "1.17.0")]
impl fmt::Debug for EncodeUtf16<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EncodeUtf16 { .. }")
f.debug_struct("EncodeUtf16").finish_non_exhaustive()
}
}

View file

@ -2257,7 +2257,7 @@ where
F: FnMut(&K, &mut V) -> bool,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("DrainFilter { .. }")
f.debug_struct("DrainFilter").finish_non_exhaustive()
}
}
@ -2957,7 +2957,7 @@ impl Default for RandomState {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for RandomState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("RandomState { .. }")
f.debug_struct("RandomState").finish_non_exhaustive()
}
}

View file

@ -1533,7 +1533,7 @@ where
F: FnMut(&K) -> bool,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("DrainFilter { .. }")
f.debug_struct("DrainFilter").finish_non_exhaustive()
}
}

View file

@ -154,7 +154,7 @@ impl Iterator for Vars {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Vars {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Vars { .. }")
f.debug_struct("Vars").finish_non_exhaustive()
}
}
@ -172,7 +172,7 @@ impl Iterator for VarsOs {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for VarsOs {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("VarsOs { .. }")
f.debug_struct("VarOs").finish_non_exhaustive()
}
}
@ -419,7 +419,7 @@ impl<'a> Iterator for SplitPaths<'a> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for SplitPaths<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("SplitPaths { .. }")
f.debug_struct("SplitPaths").finish_non_exhaustive()
}
}

View file

@ -373,7 +373,7 @@ impl Stdin {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdin {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdin { .. }")
f.debug_struct("Stdin").finish_non_exhaustive()
}
}
@ -467,7 +467,7 @@ impl BufRead for StdinLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdinLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdinLock { .. }")
f.debug_struct("StdinLock").finish_non_exhaustive()
}
}
@ -607,7 +607,7 @@ impl Stdout {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdout {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdout { .. }")
f.debug_struct("Stdout").finish_non_exhaustive()
}
}
@ -689,7 +689,7 @@ impl Write for StdoutLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdoutLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdoutLock { .. }")
f.debug_struct("StdoutLock").finish_non_exhaustive()
}
}
@ -804,7 +804,7 @@ impl Stderr {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stderr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stderr { .. }")
f.debug_struct("Stderr").finish_non_exhaustive()
}
}
@ -886,7 +886,7 @@ impl Write for StderrLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StderrLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StderrLock { .. }")
f.debug_struct("StderrLock").finish_non_exhaustive()
}
}

View file

@ -78,7 +78,7 @@ impl Seek for Empty {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Empty {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Empty { .. }")
f.debug_struct("Empty").finish_non_exhaustive()
}
}
@ -150,7 +150,7 @@ impl Read for Repeat {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Repeat { .. }")
f.debug_struct("Repeat").finish_non_exhaustive()
}
}
@ -236,6 +236,6 @@ impl Write for &Sink {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Sink {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Sink { .. }")
f.debug_struct("Sink").finish_non_exhaustive()
}
}

View file

@ -312,7 +312,7 @@ impl FromInner<AnonPipe> for ChildStdin {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStdin {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStdin { .. }")
f.debug_struct("ChildStdin").finish_non_exhaustive()
}
}
@ -373,7 +373,7 @@ impl FromInner<AnonPipe> for ChildStdout {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStdout {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStdout { .. }")
f.debug_struct("ChildStdout").finish_non_exhaustive()
}
}
@ -434,7 +434,7 @@ impl FromInner<AnonPipe> for ChildStderr {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStderr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStderr { .. }")
f.debug_struct("ChildStderr").finish_non_exhaustive()
}
}
@ -1257,7 +1257,7 @@ impl FromInner<imp::Stdio> for Stdio {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdio {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdio { .. }")
f.debug_struct("Stdio").finish_non_exhaustive()
}
}

View file

@ -60,7 +60,7 @@ pub struct BarrierWaitResult(bool);
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Barrier {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Barrier { .. }")
f.debug_struct("Barrier").finish_non_exhaustive()
}
}

View file

@ -548,7 +548,7 @@ impl Condvar {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Condvar {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Condvar { .. }")
f.debug_struct("Condvar").finish_non_exhaustive()
}
}

View file

@ -1477,7 +1477,7 @@ impl<T> fmt::Debug for Receiver<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"SendError(..)".fmt(f)
f.debug_struct("SendError").finish_non_exhaustive()
}
}

View file

@ -481,7 +481,7 @@ fn wait(state_and_queue: &AtomicUsize, mut current_state: usize) {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Once {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Once { .. }")
f.debug_struct("Once").finish_non_exhaustive()
}
}

View file

@ -127,7 +127,7 @@ pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for PoisonError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"PoisonError { inner: .. }".fmt(f)
f.debug_struct("PoisonError").finish_non_exhaustive()
}
}

View file

@ -100,7 +100,7 @@ pub struct LocalKey<T: 'static> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: 'static> fmt::Debug for LocalKey<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("LocalKey { .. }")
f.debug_struct("LocalKey").finish_non_exhaustive()
}
}
@ -472,7 +472,7 @@ pub mod statik {
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
f.debug_struct("Key").finish_non_exhaustive()
}
}
@ -537,7 +537,7 @@ pub mod fast {
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
f.debug_struct("Key").finish_non_exhaustive()
}
}
@ -651,7 +651,7 @@ pub mod os {
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
f.debug_struct("Key").finish_non_exhaustive()
}
}

View file

@ -1413,7 +1413,7 @@ impl<T> IntoInner<imp::Thread> for JoinHandle<T> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T> fmt::Debug for JoinHandle<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("JoinHandle { .. }")
f.debug_struct("JoinHandle").finish_non_exhaustive()
}
}