Skip to content

Commit 7c01e6c

Browse files
committed
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.
1 parent feaac19 commit 7c01e6c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

library/std/src/io/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,7 @@ pub trait BufRead: Read {
21142114
///
21152115
/// [`chain`]: Read::chain
21162116
#[stable(feature = "rust1", since = "1.0.0")]
2117+
#[derive(Debug)]
21172118
pub struct Chain<T, U> {
21182119
first: T,
21192120
second: U,
@@ -2195,13 +2196,6 @@ impl<T, U> Chain<T, U> {
21952196
}
21962197
}
21972198

2198-
#[stable(feature = "std_debug", since = "1.16.0")]
2199-
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
2200-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2201-
f.debug_struct("Chain").field("t", &self.first).field("u", &self.second).finish()
2202-
}
2203-
}
2204-
22052199
#[stable(feature = "rust1", since = "1.0.0")]
22062200
impl<T: Read, U: Read> Read for Chain<T, U> {
22072201
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {

0 commit comments

Comments
 (0)