Directly display to the Formatter

This allows formatter flags to take effect.
This commit is contained in:
David Tolnay 2020-05-09 17:28:28 -07:00
parent 16bf9871cd
commit 850a29beb1
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -11,7 +11,7 @@ macro_rules! fmt_primitives {
($($f:ident: $t:ty,)*) => {
$(
fn $f(self, v: $t) -> fmt::Result {
write!(self, "{}", v)
Display::fmt(&v, self)
}
)*
};
@ -51,7 +51,7 @@ impl<'a, 'b> Serializer for &'a mut fmt::Formatter<'b> {
_variant_index: u32,
variant: &'static str,
) -> fmt::Result {
write!(self, "{}", variant)
Display::fmt(variant, self)
}
fn serialize_bytes(self, _v: &[u8]) -> fmt::Result {