Skip to content

Commit 53cc806

Browse files
authored
Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726
Use DebugStruct::finish_non_exhaustive() in std. See #67364
2 parents fa70398 + 2afa4cc commit 53cc806

File tree

8 files changed

+21
-15
lines changed

8 files changed

+21
-15
lines changed

library/std/src/collections/hash/map.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
17931793
#[unstable(feature = "hash_raw_entry", issue = "56167")]
17941794
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
17951795
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1796-
f.debug_struct("RawEntryBuilder").finish()
1796+
f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
17971797
}
17981798
}
17991799

@@ -1813,21 +1813,21 @@ impl<K: Debug, V: Debug, S> Debug for RawOccupiedEntryMut<'_, K, V, S> {
18131813
f.debug_struct("RawOccupiedEntryMut")
18141814
.field("key", self.key())
18151815
.field("value", self.get())
1816-
.finish()
1816+
.finish_non_exhaustive()
18171817
}
18181818
}
18191819

18201820
#[unstable(feature = "hash_raw_entry", issue = "56167")]
18211821
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
18221822
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1823-
f.debug_struct("RawVacantEntryMut").finish()
1823+
f.debug_struct("RawVacantEntryMut").finish_non_exhaustive()
18241824
}
18251825
}
18261826

18271827
#[unstable(feature = "hash_raw_entry", issue = "56167")]
18281828
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
18291829
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1830-
f.debug_struct("RawEntryBuilder").finish()
1830+
f.debug_struct("RawEntryBuilder").finish_non_exhaustive()
18311831
}
18321832
}
18331833

@@ -1867,7 +1867,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
18671867
#[stable(feature = "debug_hash_map", since = "1.12.0")]
18681868
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
18691869
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1870-
f.debug_struct("OccupiedEntry").field("key", self.key()).field("value", self.get()).finish()
1870+
f.debug_struct("OccupiedEntry")
1871+
.field("key", self.key())
1872+
.field("value", self.get())
1873+
.finish_non_exhaustive()
18711874
}
18721875
}
18731876

@@ -1903,7 +1906,7 @@ impl<K: Debug, V: Debug> Debug for OccupiedError<'_, K, V> {
19031906
.field("key", self.entry.key())
19041907
.field("old_value", self.entry.get())
19051908
.field("new_value", &self.value)
1906-
.finish()
1909+
.finish_non_exhaustive()
19071910
}
19081911
}
19091912

library/std/src/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ impl fmt::Debug for Metadata {
11541154
.field("modified", &self.modified())
11551155
.field("accessed", &self.accessed())
11561156
.field("created", &self.created())
1157-
.finish()
1157+
.finish_non_exhaustive()
11581158
}
11591159
}
11601160

library/std/src/io/buffered/linewriter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,6 @@ where
227227
"buffer",
228228
&format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()),
229229
)
230-
.finish()
230+
.finish_non_exhaustive()
231231
}
232232
}

library/std/src/lazy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> {
515515
#[unstable(feature = "once_cell", issue = "74465")]
516516
impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> {
517517
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
518-
f.debug_struct("Lazy").field("cell", &self.cell).field("init", &"..").finish()
518+
f.debug_struct("Lazy").field("cell", &self.cell).finish_non_exhaustive()
519519
}
520520
}
521521

library/std/src/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl fmt::Debug for Child {
234234
.field("stdin", &self.stdin)
235235
.field("stdout", &self.stdout)
236236
.field("stderr", &self.stderr)
237-
.finish()
237+
.finish_non_exhaustive()
238238
}
239239
}
240240

library/std/src/sync/mpsc/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ impl<T> Drop for Sender<T> {
864864
#[stable(feature = "mpsc_debug", since = "1.8.0")]
865865
impl<T> fmt::Debug for Sender<T> {
866866
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
867-
f.debug_struct("Sender").finish()
867+
f.debug_struct("Sender").finish_non_exhaustive()
868868
}
869869
}
870870

@@ -991,7 +991,7 @@ impl<T> Drop for SyncSender<T> {
991991
#[stable(feature = "mpsc_debug", since = "1.8.0")]
992992
impl<T> fmt::Debug for SyncSender<T> {
993993
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
994-
f.debug_struct("SyncSender").finish()
994+
f.debug_struct("SyncSender").finish_non_exhaustive()
995995
}
996996
}
997997

@@ -1470,7 +1470,7 @@ impl<T> Drop for Receiver<T> {
14701470
#[stable(feature = "mpsc_debug", since = "1.8.0")]
14711471
impl<T> fmt::Debug for Receiver<T> {
14721472
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1473-
f.debug_struct("Receiver").finish()
1473+
f.debug_struct("Receiver").finish_non_exhaustive()
14741474
}
14751475
}
14761476

library/std/src/sys/wasi/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl FileType {
130130

131131
impl fmt::Debug for ReadDir {
132132
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
133-
f.debug_struct("ReadDir").finish()
133+
f.debug_struct("ReadDir").finish_non_exhaustive()
134134
}
135135
}
136136

library/std/src/thread/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,10 @@ impl Thread {
11761176
#[stable(feature = "rust1", since = "1.0.0")]
11771177
impl fmt::Debug for Thread {
11781178
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1179-
f.debug_struct("Thread").field("id", &self.id()).field("name", &self.name()).finish()
1179+
f.debug_struct("Thread")
1180+
.field("id", &self.id())
1181+
.field("name", &self.name())
1182+
.finish_non_exhaustive()
11801183
}
11811184
}
11821185

0 commit comments

Comments
 (0)