Skip to content

Commit 230b97a

Browse files
committed
Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton
atomic: remove 'Atomic*' from Debug output For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.
2 parents 8830a03 + c689db2 commit 230b97a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/libcore/sync/atomic.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,7 @@ macro_rules! atomic_int {
990990
#[$stable_debug]
991991
impl fmt::Debug for $atomic_type {
992992
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
993-
f.debug_tuple(stringify!($atomic_type))
994-
.field(&self.load(Ordering::SeqCst))
995-
.finish()
993+
fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
996994
}
997995
}
998996

@@ -2090,15 +2088,15 @@ pub fn compiler_fence(order: Ordering) {
20902088
#[stable(feature = "atomic_debug", since = "1.3.0")]
20912089
impl fmt::Debug for AtomicBool {
20922090
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2093-
f.debug_tuple("AtomicBool").field(&self.load(Ordering::SeqCst)).finish()
2091+
fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
20942092
}
20952093
}
20962094

20972095
#[cfg(target_has_atomic = "ptr")]
20982096
#[stable(feature = "atomic_debug", since = "1.3.0")]
20992097
impl<T> fmt::Debug for AtomicPtr<T> {
21002098
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2101-
f.debug_tuple("AtomicPtr").field(&self.load(Ordering::SeqCst)).finish()
2099+
fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
21022100
}
21032101
}
21042102

0 commit comments

Comments
 (0)