Skip to content

Commit fdae757

Browse files
committed
Change the Debug impl of Any and UnsafeCell to use finish_non_exhaustive
1 parent 1fb3256 commit fdae757

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library/core/src/any.rs

+3-3
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.debug_struct("Any").finish()
144+
f.debug_struct("Any").finish_non_exhaustive()
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.debug_struct("Any").finish()
154+
f.debug_struct("Any").finish_non_exhaustive()
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.debug_struct("Any").finish()
161+
f.debug_struct("Any").finish_non_exhaustive()
162162
}
163163
}
164164

library/core/src/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -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.debug_struct("UnsafeCell").finish()
2273+
f.debug_struct("UnsafeCell").finish_non_exhaustive()
22742274
}
22752275
}
22762276

0 commit comments

Comments
 (0)