Skip to content

Commit

Permalink
Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726
Browse files Browse the repository at this point in the history
Use DebugStruct::finish_non_exhaustive() in std.

See #67364
  • Loading branch information
JohnTitor authored Mar 27, 2021
2 parents fa70398 + 2afa4cc commit 53cc806
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
15 changes: 9 additions & 6 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand All @@ -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()
}
}

Expand Down Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/buffered/linewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ where
"buffer",
&format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()),
)
.finish()
.finish_non_exhaustive()
}
}
2 changes: 1 addition & 1 deletion library/std/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
6 changes: 3 additions & 3 deletions library/std/src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/wasi/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
5 changes: 4 additions & 1 deletion library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 53cc806

Please sign in to comment.