Skip to content

Commit 4921906

Browse files
committed
Replace integer to_string with itoa
1 parent 59112ae commit 4921906

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/number.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ impl From<ParserNumber> for Number {
702702
}
703703
#[cfg(feature = "arbitrary_precision")]
704704
{
705-
u.to_string()
705+
itoa::Buffer::new().format(u).to_owned()
706706
}
707707
}
708708
ParserNumber::I64(i) => {
@@ -712,7 +712,7 @@ impl From<ParserNumber> for Number {
712712
}
713713
#[cfg(feature = "arbitrary_precision")]
714714
{
715-
i.to_string()
715+
itoa::Buffer::new().format(i).to_owned()
716716
}
717717
}
718718
#[cfg(feature = "arbitrary_precision")]

src/value/ser.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,43 +490,43 @@ impl serde::Serializer for MapKeySerializer {
490490
}
491491

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)