未验证 提交 53cc8065 编写于 作者: Y Yuki Okushi 提交者: GitHub

Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726

Use DebugStruct::finish_non_exhaustive() in std.

See https://github.com/rust-lang/rust/issues/67364
...@@ -1793,7 +1793,7 @@ pub fn insert_hashed_nocheck(self, hash: u64, key: K, value: V) -> (&'a mut K, & ...@@ -1793,7 +1793,7 @@ pub fn insert_hashed_nocheck(self, hash: u64, key: K, value: V) -> (&'a mut K, &
#[unstable(feature = "hash_raw_entry", issue = "56167")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> { impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1813,21 +1813,21 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawOccupiedEntryMut") f.debug_struct("RawOccupiedEntryMut")
.field("key", self.key()) .field("key", self.key())
.field("value", self.get()) .field("value", self.get())
.finish() .finish_non_exhaustive()
} }
} }
#[unstable(feature = "hash_raw_entry", issue = "56167")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> { impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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")] #[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> { impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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> { ...@@ -1867,7 +1867,10 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
#[stable(feature = "debug_hash_map", since = "1.12.0")] #[stable(feature = "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> { impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1903,7 +1906,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("key", self.entry.key()) .field("key", self.entry.key())
.field("old_value", self.entry.get()) .field("old_value", self.entry.get())
.field("new_value", &self.value) .field("new_value", &self.value)
.finish() .finish_non_exhaustive()
} }
} }
......
...@@ -1154,7 +1154,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -1154,7 +1154,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("modified", &self.modified()) .field("modified", &self.modified())
.field("accessed", &self.accessed()) .field("accessed", &self.accessed())
.field("created", &self.created()) .field("created", &self.created())
.finish() .finish_non_exhaustive()
} }
} }
......
...@@ -227,6 +227,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -227,6 +227,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
"buffer", "buffer",
&format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()), &format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()),
) )
.finish() .finish_non_exhaustive()
} }
} }
...@@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> { ...@@ -515,7 +515,7 @@ pub struct SyncLazy<T, F = fn() -> T> {
#[unstable(feature = "once_cell", issue = "74465")] #[unstable(feature = "once_cell", issue = "74465")]
impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> { impl<T: fmt::Debug, F> fmt::Debug for SyncLazy<T, F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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()
} }
} }
......
...@@ -234,7 +234,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -234,7 +234,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
.field("stdin", &self.stdin) .field("stdin", &self.stdin)
.field("stdout", &self.stdout) .field("stdout", &self.stdout)
.field("stderr", &self.stderr) .field("stderr", &self.stderr)
.finish() .finish_non_exhaustive()
} }
} }
......
...@@ -864,7 +864,7 @@ fn drop(&mut self) { ...@@ -864,7 +864,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Sender<T> { impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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 @@ fn drop(&mut self) { ...@@ -991,7 +991,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for SyncSender<T> { impl<T> fmt::Debug for SyncSender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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 @@ fn drop(&mut self) { ...@@ -1470,7 +1470,7 @@ fn drop(&mut self) {
#[stable(feature = "mpsc_debug", since = "1.8.0")] #[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Receiver<T> { impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Receiver").finish() f.debug_struct("Receiver").finish_non_exhaustive()
} }
} }
......
...@@ -130,7 +130,7 @@ pub fn bits(&self) -> wasi::Filetype { ...@@ -130,7 +130,7 @@ pub fn bits(&self) -> wasi::Filetype {
impl fmt::Debug for ReadDir { impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ReadDir").finish() f.debug_struct("ReadDir").finish_non_exhaustive()
} }
} }
......
...@@ -1176,7 +1176,10 @@ fn cname(&self) -> Option<&CStr> { ...@@ -1176,7 +1176,10 @@ fn cname(&self) -> Option<&CStr> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Thread { impl fmt::Debug for Thread {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 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()
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册