Skip to content

Commit

Permalink
Replace integer to_string with itoa
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Sep 4, 2024
1 parent 59112ae commit 4921906
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl From<ParserNumber> for Number {
}
#[cfg(feature = "arbitrary_precision")]
{
u.to_string()
itoa::Buffer::new().format(u).to_owned()
}
}
ParserNumber::I64(i) => {
Expand All @@ -712,7 +712,7 @@ impl From<ParserNumber> for Number {
}
#[cfg(feature = "arbitrary_precision")]
{
i.to_string()
itoa::Buffer::new().format(i).to_owned()
}
}
#[cfg(feature = "arbitrary_precision")]
Expand Down
20 changes: 10 additions & 10 deletions src/value/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,43 +490,43 @@ impl serde::Serializer for MapKeySerializer {
}

fn serialize_i8(self, value: i8) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_i16(self, value: i16) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_i32(self, value: i32) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_i64(self, value: i64) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_i128(self, value: i128) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_u8(self, value: u8) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_u16(self, value: u16) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_u32(self, value: u32) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_u64(self, value: u64) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_u128(self, value: u128) -> Result<String> {
Ok(value.to_string())
Ok(itoa::Buffer::new().format(value).to_owned())
}

fn serialize_f32(self, value: f32) -> Result<String> {
Expand Down

0 comments on commit 4921906

Please sign in to comment.