From a1db237cd48e9218f1ea5915c8fd2132dd72358e Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 10 Jan 2018 09:21:15 +0100 Subject: [PATCH] Preserve formatting options in Debug for NonNull/Unique --- src/libcore/ptr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 4e9123fec9767..261291b747f89 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2346,7 +2346,7 @@ pub struct Unique { #[unstable(feature = "ptr_internals", issue = "0")] impl fmt::Debug for Unique { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:p}", self.as_ptr()) + fmt::Pointer::fmt(&self.as_ptr(), f) } } @@ -2489,7 +2489,7 @@ pub struct NonNull { #[stable(feature = "nonnull", since = "1.24.0")] impl fmt::Debug for NonNull { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:p}", self.as_ptr()) + fmt::Pointer::fmt(&self.as_ptr(), f) } }