Skip to content

Commit

Permalink
Merge pull request #1764 from serde-rs/collect
Browse files Browse the repository at this point in the history
Simplify default Serializer::collect_str implementation
  • Loading branch information
dtolnay authored Mar 28, 2020
2 parents 69653a7 + e2ada0e commit 2a9971a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions serde/src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,10 +1359,7 @@ pub trait Serializer: Sized {
where
T: Display,
{
use lib::fmt::Write;
let mut string = String::new();
write!(string, "{}", value).unwrap();
self.serialize_str(&string)
self.serialize_str(&value.to_string())
}

/// Serialize a string produced by an implementation of `Display`.
Expand Down

0 comments on commit 2a9971a

Please sign in to comment.