Skip to content

Commit

Permalink
Simplify default Serializer::collect_str implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 28, 2020
1 parent 69653a7 commit e2ada0e
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 e2ada0e

Please sign in to comment.