mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 15:25:38 +00:00
Simplify default Serializer::collect_str implementation
This commit is contained in:
parent
69653a762d
commit
e2ada0efef
@ -1359,10 +1359,7 @@ pub trait Serializer: Sized {
|
|||||||
where
|
where
|
||||||
T: Display,
|
T: Display,
|
||||||
{
|
{
|
||||||
use lib::fmt::Write;
|
self.serialize_str(&value.to_string())
|
||||||
let mut string = String::new();
|
|
||||||
write!(string, "{}", value).unwrap();
|
|
||||||
self.serialize_str(&string)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serialize a string produced by an implementation of `Display`.
|
/// Serialize a string produced by an implementation of `Display`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user