Skip to content

Commit 1fb3256

Browse files
committed
Replace all fmt.pad with debug_struct
1 parent 6265286 commit 1fb3256

File tree

21 files changed

+40
-40
lines changed

21 files changed

+40
-40
lines changed

library/core/src/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<T: 'static + ?Sized> Any for T {
141141
#[stable(feature = "rust1", since = "1.0.0")]
142142
impl fmt::Debug for dyn Any {
143143
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
144-
f.pad("Any")
144+
f.debug_struct("Any").finish()
145145
}
146146
}
147147

@@ -151,14 +151,14 @@ impl fmt::Debug for dyn Any {
151151
#[stable(feature = "rust1", since = "1.0.0")]
152152
impl fmt::Debug for dyn Any + Send {
153153
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
154-
f.pad("Any")
154+
f.debug_struct("Any").finish()
155155
}
156156
}
157157

158158
#[stable(feature = "any_send_sync_methods", since = "1.28.0")]
159159
impl fmt::Debug for dyn Any + Send + Sync {
160160
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
161-
f.pad("Any")
161+
f.debug_struct("Any").finish()
162162
}
163163
}
164164

library/core/src/ascii.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ impl fmt::Display for EscapeDefault {
145145
#[stable(feature = "std_debug", since = "1.16.0")]
146146
impl fmt::Debug for EscapeDefault {
147147
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
148-
f.pad("EscapeDefault { .. }")
148+
f.debug_struct("EscapeDefault").finish_non_exhaustive()
149149
}
150150
}

library/core/src/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub enum c_void {
5353
#[stable(feature = "std_debug", since = "1.16.0")]
5454
impl fmt::Debug for c_void {
5555
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
56-
f.pad("c_void")
56+
f.debug_struct("c_void").finish()
5757
}
5858
}
5959

library/core/src/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ impl Debug for () {
22202220
#[stable(feature = "rust1", since = "1.0.0")]
22212221
impl<T: ?Sized> Debug for PhantomData<T> {
22222222
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
2223-
f.pad("PhantomData")
2223+
f.debug_struct("PhantomData").finish()
22242224
}
22252225
}
22262226

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

library/core/src/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ pub struct BuildHasherDefault<H>(marker::PhantomData<H>);
507507
#[stable(since = "1.9.0", feature = "core_impl_debug")]
508508
impl<H> fmt::Debug for BuildHasherDefault<H> {
509509
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
510-
f.pad("BuildHasherDefault")
510+
f.debug_struct("BuildHasherDefault").finish()
511511
}
512512
}
513513

library/core/src/iter/sources/empty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ unsafe impl<T> Sync for Empty<T> {}
3636
#[stable(feature = "core_impl_debug", since = "1.9.0")]
3737
impl<T> fmt::Debug for Empty<T> {
3838
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39-
f.pad("Empty")
39+
f.debug_struct("Empty").finish()
4040
}
4141
}
4242

library/core/src/slice/ascii.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'a> fmt::Display for EscapeAscii<'a> {
146146
#[unstable(feature = "inherent_ascii_escape", issue = "77174")]
147147
impl<'a> fmt::Debug for EscapeAscii<'a> {
148148
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
149-
f.pad("EscapeAscii { .. }")
149+
f.debug_struct("EscapeAscii").finish_non_exhaustive()
150150
}
151151
}
152152

library/core/src/str/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ pub struct EncodeUtf16<'a> {
13591359
#[stable(feature = "collection_debug", since = "1.17.0")]
13601360
impl fmt::Debug for EncodeUtf16<'_> {
13611361
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1362-
f.pad("EncodeUtf16 { .. }")
1362+
f.debug_struct("EncodeUtf16").finish_non_exhaustive()
13631363
}
13641364
}
13651365

library/std/src/collections/hash/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,7 @@ where
22572257
F: FnMut(&K, &mut V) -> bool,
22582258
{
22592259
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2260-
f.pad("DrainFilter { .. }")
2260+
f.debug_struct("DrainFilter").finish_non_exhaustive()
22612261
}
22622262
}
22632263

@@ -2957,7 +2957,7 @@ impl Default for RandomState {
29572957
#[stable(feature = "std_debug", since = "1.16.0")]
29582958
impl fmt::Debug for RandomState {
29592959
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2960-
f.pad("RandomState { .. }")
2960+
f.debug_struct("RandomState").finish_non_exhaustive()
29612961
}
29622962
}
29632963

library/std/src/collections/hash/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ where
15331533
F: FnMut(&K) -> bool,
15341534
{
15351535
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1536-
f.pad("DrainFilter { .. }")
1536+
f.debug_struct("DrainFilter").finish_non_exhaustive()
15371537
}
15381538
}
15391539

0 commit comments

Comments
 (0)