Use DebugStruct::finish_non_exhaustive() in std.

This commit is contained in:
Mara Bos 2021-03-27 13:29:23 +01:00
parent feaac19f17
commit 2afa4cc958
8 changed files with 21 additions and 15 deletions

View file

@ -1793,7 +1793,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder").finish()
f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
}
}
@ -1813,21 +1813,21 @@ impl<K: Debug, V: Debug, S> Debug for RawOccupiedEntryMut<'_, K, V, S> {
f.debug_struct("RawOccupiedEntryMut")
.field("key", self.key())
.field("value", self.get())
.finish()
.finish_non_exhaustive()
}
}
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawVacantEntryMut").finish()
f.debug_struct("RawVacantEntryMut").finish_non_exhaustive()
}
}
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder").finish()
f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
}
}
@ -1867,7 +1867,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
#[stable(feature = "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry").field("key", self.key()).field("value", self.get()).finish()
f.debug_struct("OccupiedEntry")
.field("key", self.key())
.field("value", self.get())
.finish_non_exhaustive()
}
}
@ -1903,7 +1906,7 @@ impl<K: Debug, V: Debug> Debug for OccupiedError<'_, K, V> {
.field("key", self.entry.key())
.field("old_value", self.entry.get())
.field("new_value", &self.value)
.finish()
.finish_non_exhaustive()
}
}

View file

@ -1154,7 +1154,7 @@ impl fmt::Debug for Metadata {
.field("modified", &self.modified())
.field("accessed", &self.accessed())
.field("created", &self.created())
.finish()
.finish_non_exhaustive()
}
}

View file

@ -227,6 +227,6 @@ where
"buffer",
&format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()),
)
.finish()
.finish_non_exhaustive()
}
}

View file

@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> {
#[unstable(feature = "once_cell", issue = "74465")]
impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Lazy").field("cell", &self.cell).field("init", &"..").finish()
f.debug_struct("Lazy").field("cell", &self.cell).finish_non_exhaustive()
}
}

View file

@ -234,7 +234,7 @@ impl fmt::Debug for Child {
.field("stdin", &self.stdin)
.field("stdout", &self.stdout)
.field("stderr", &self.stderr)
.finish()
.finish_non_exhaustive()
}
}

View file

@ -864,7 +864,7 @@ impl<T> Drop for Sender<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Sender").finish()
f.debug_struct("Sender").finish_non_exhaustive()
}
}
@ -991,7 +991,7 @@ impl<T> Drop for SyncSender<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for SyncSender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SyncSender").finish()
f.debug_struct("SyncSender").finish_non_exhaustive()
}
}
@ -1470,7 +1470,7 @@ impl<T> Drop for Receiver<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Receiver").finish()
f.debug_struct("Receiver").finish_non_exhaustive()
}
}

View file

@ -130,7 +130,7 @@ impl FileType {
impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ReadDir").finish()
f.debug_struct("ReadDir").finish_non_exhaustive()
}
}

View file

@ -1176,7 +1176,10 @@ impl Thread {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Thread {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Thread").field("id", &self.id()).field("name", &self.name()).finish()
f.debug_struct("Thread")
.field("id", &self.id())
.field("name", &self.name())
.finish_non_exhaustive()
}
}