Improve FnPtr debug print.
This commit is contained in:
parent
4ec16d14e0
commit
ff2a23189a
@ -49,16 +49,19 @@ impl fmt::Debug for FnPtr {
|
|||||||
#[cold]
|
#[cold]
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
if self.is_curried() {
|
let ff = &mut f.debug_tuple("Fn");
|
||||||
self.curry
|
ff.field(&self.name);
|
||||||
.iter()
|
self.curry.iter().for_each(|curry| {
|
||||||
.fold(f.debug_tuple("Fn").field(&self.name), |f, curry| {
|
ff.field(curry);
|
||||||
f.field(curry)
|
});
|
||||||
})
|
ff.finish()?;
|
||||||
.finish()
|
|
||||||
} else {
|
#[cfg(not(feature = "no_function"))]
|
||||||
write!(f, "Fn({})", self.fn_name())
|
if let Some(ref fn_def) = self.fn_def {
|
||||||
|
write!(f, ": {fn_def}")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user