Skip to content

Commit

Permalink
Convert i/u128 conversion to itoa instead of std::fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 20, 2022
1 parent 84c157b commit 1a43381
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,15 @@ impl_from_signed!(i8, i16, i32, i64, isize);
serde_if_integer128! {
impl From<i128> for Number {
fn from(i: i128) -> Self {
Number { n: i.to_string() }
let n = itoa::Buffer::new().format(i).to_owned();
Number { n }
}
}

impl From<u128> for Number {
fn from(u: u128) -> Self {
Number { n: u.to_string() }
let n = itoa::Buffer::new().format(u).to_owned();
Number { n }
}
}
}
Expand Down

0 comments on commit 1a43381

Please sign in to comment.