Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a1db237

Browse files
committed
Preserve formatting options in Debug for NonNull/Unique
1 parent 943a9e7 commit a1db237

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ pub struct Unique<T: ?Sized> {
23462346
#[unstable(feature = "ptr_internals", issue = "0")]
23472347
impl<T: ?Sized> fmt::Debug for Unique<T> {
23482348
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2349-
write!(f, "{:p}", self.as_ptr())
2349+
fmt::Pointer::fmt(&self.as_ptr(), f)
23502350
}
23512351
}
23522352

@@ -2489,7 +2489,7 @@ pub struct NonNull<T: ?Sized> {
24892489
#[stable(feature = "nonnull", since = "1.24.0")]
24902490
impl<T: ?Sized> fmt::Debug for NonNull<T> {
24912491
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2492-
write!(f, "{:p}", self.as_ptr())
2492+
fmt::Pointer::fmt(&self.as_ptr(), f)
24932493
}
24942494
}
24952495

0 commit comments

Comments
 (0)