Skip to content

Commit bc9d007

Browse files
author
Vytautas Astrauskas
committed
Improve Debug formatting of the thread name.
1 parent 04abf06 commit bc9d007

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/thread.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,9 @@ impl<'mir, 'tcx> Thread<'mir, 'tcx> {
132132
impl<'mir, 'tcx> std::fmt::Debug for Thread<'mir, 'tcx> {
133133
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
134134
if let Some(ref name) = self.thread_name {
135-
if let Ok(name_str) = std::str::from_utf8(name) {
136-
write!(f, "{}", name_str)?;
137-
} else {
138-
write!(f, "<invalid thread name>")?;
139-
}
135+
write!(f, "{}", String::from_utf8_lossy(name))?;
140136
} else {
141-
write!(f, "unnamed")?;
137+
write!(f, "<unnamed>")?;
142138
}
143139
write!(f, "({:?}, {:?})", self.state, self.join_status)
144140
}

0 commit comments

Comments
 (0)