Skip to content

Commit a2c4562

Browse files
authored
Rollup merge of #59460 - xfix:include-id-in-thread-debug, r=Amanieu
Include id in Thread's Debug implementation Since Rust 1.19.0, `id` is a stable method, so there is no reason to not include it in Debug implementation.
2 parents 4a322f5 + ba21e0b commit a2c4562

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libstd/thread/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,10 @@ impl Thread {
12571257
#[stable(feature = "rust1", since = "1.0.0")]
12581258
impl fmt::Debug for Thread {
12591259
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1260-
fmt::Debug::fmt(&self.name(), f)
1260+
f.debug_struct("Thread")
1261+
.field("id", &self.id())
1262+
.field("name", &self.name())
1263+
.finish()
12611264
}
12621265
}
12631266

0 commit comments

Comments
 (0)