Use collect_str instead of serialize_str in serde macros

This commit is contained in:
Steven Roose 2019-06-06 11:07:41 +01:00
parent fc6415d652
commit 4530e403e0
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 3 additions and 3 deletions

View File

@ -451,7 +451,7 @@ macro_rules! serde_string_impl {
where where
S: $crate::serde::Serializer, S: $crate::serde::Serializer,
{ {
serializer.serialize_str(&self.to_string()) serializer.collect_str(&self)
} }
} }
}; };
@ -601,7 +601,7 @@ macro_rules! serde_struct_human_string_impl {
S: $crate::serde::Serializer, S: $crate::serde::Serializer,
{ {
if serializer.is_human_readable() { if serializer.is_human_readable() {
serializer.serialize_str(&self.to_string()) serializer.collect_str(&self)
} else { } else {
use $crate::serde::ser::SerializeStruct; use $crate::serde::ser::SerializeStruct;
@ -719,7 +719,7 @@ macro_rules! user_enum {
where where
S: ::serde::Serializer, S: ::serde::Serializer,
{ {
serializer.serialize_str(&self.to_string()) serializer.collect_str(&self)
} }
} }
); );