From 2afa4cc958d3d65957083f3ae0bded237cce9a87 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sat, 27 Mar 2021 13:29:23 +0100 Subject: Use DebugStruct::finish_non_exhaustive() in std. --- library/std/src/io/buffered/linewriter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'library/std/src/io') diff --git a/library/std/src/io/buffered/linewriter.rs b/library/std/src/io/buffered/linewriter.rs index 502c6e3c6c0..d7b620d6f91 100644 --- a/library/std/src/io/buffered/linewriter.rs +++ b/library/std/src/io/buffered/linewriter.rs @@ -227,6 +227,6 @@ where "buffer", &format_args!("{}/{}", self.inner.buffer().len(), self.inner.capacity()), ) - .finish() + .finish_non_exhaustive() } } -- cgit 1.4.1-3-g733a5 From 7c01e6c38a11a9814da121200c64df5a62a455b1 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sat, 27 Mar 2021 13:36:07 +0100 Subject: Derive Debug for io::Chain instead of manually implementing it. The manual implementation has the same bounds, so I don't think there's any reason for a manual implementation. The names used in the derive implementation are even nicer (`first`/`second`) than the manual implementation (`t`/`u`), and include the `done_first` field too. --- library/std/src/io/mod.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'library/std/src/io') diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 5316305a303..9953bcd556d 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2114,6 +2114,7 @@ pub trait BufRead: Read { /// /// [`chain`]: Read::chain #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct Chain { first: T, second: U, @@ -2195,13 +2196,6 @@ impl Chain { } } -#[stable(feature = "std_debug", since = "1.16.0")] -impl fmt::Debug for Chain { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Chain").field("t", &self.first).field("u", &self.second).finish() - } -} - #[stable(feature = "rust1", since = "1.0.0")] impl Read for Chain { fn read(&mut self, buf: &mut [u8]) -> Result { -- cgit 1.4.1-3-g733a5