Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DebugStruct::finish_non_exhaustive() in std. #83558

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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