Replace integer to_string with itoa

This commit is contained in:
David Tolnay 2024-09-04 15:19:49 -07:00
parent 59112ae7b1
commit 4921906b1d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 12 additions and 12 deletions

View File

@ -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) => {
@ -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")]

View File

@ -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> {