Closed m-mueller678 closed 2 months ago
Similarly to https://doc.rust-lang.org/src/core/fmt/mod.rs.html#451 we could indeed delegate to Display
:
impl<'a, I, F> fmt::Debug for FormatWith<'a, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}
I don't see an issue with this, but I'm not familiar with those Format/FormatWith
.
@phimuemue @jswrenn Any objection?
The value returned by
format_with
should implementstd::fmt::Debug
. Similar to the value returned bystd::format_args
, the Debug representation should be the same as the Display one. This allows using it in places likestd::fmt::DebugStruct
.