diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-04-21 23:06:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-21 23:06:11 +0200 |
| commit | a7a77371146329653deb3426b1983b8b85604797 (patch) | |
| tree | 9ca0d7805e098ed20e5850944527ee56ce903e1e /library/std/src/thread | |
| parent | b849326744a8eec939e592f0ab13bff85cc865d3 (diff) | |
| parent | fccc75cf8299158125f5785855d7235a178434d7 (diff) | |
| download | rust-a7a77371146329653deb3426b1983b8b85604797.tar.gz rust-a7a77371146329653deb3426b1983b8b85604797.zip | |
Rollup merge of #84013 - CDirkx:fmt, r=m-ou-se
Replace all `fmt.pad` with `debug_struct`
This replaces any occurrence of:
- `f.pad("X")` with `f.debug_struct("X").finish()`
- `f.pad("X { .. }")` with `f.debug_struct("X").finish_non_exhaustive()`
This is in line with existing formatting code such as
https://github.com/rust-lang/rust/blob/125505306744a0a5bb01d62337260a95d9ff8d57/library/std/src/sync/mpsc/mod.rs#L1470-L1475
Diffstat (limited to 'library/std/src/thread')
| -rw-r--r-- | library/std/src/thread/local.rs | 8 | ||||
| -rw-r--r-- | library/std/src/thread/mod.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 3dcf7e33453..abd5b778483 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -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() } } diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 54e39f76274..30d8c2a1b6f 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -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() } } |
