mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
sync: expand Debug for Mutex<T> impl to unsized T (#4134)
This commit is contained in:
@@ -496,14 +496,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> std::fmt::Debug for Mutex<T>
|
||||
impl<T: ?Sized> std::fmt::Debug for Mutex<T>
|
||||
where
|
||||
T: std::fmt::Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let mut d = f.debug_struct("Mutex");
|
||||
match self.try_lock() {
|
||||
Ok(inner) => d.field("data", &*inner),
|
||||
Ok(inner) => d.field("data", &&*inner),
|
||||
Err(_) => d.field("data", &format_args!("<locked>")),
|
||||
};
|
||||
d.finish()
|
||||
|
||||
Reference in New Issue
Block a user