serde: Upgrade itoa 0.4 => 1.0

This commit is contained in:
Jonas Platte 2022-02-17 16:27:43 +01:00
parent f9b9112d07
commit 2547db74e9
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 3 additions and 4 deletions

View File

@ -11,7 +11,7 @@ edition = "2018"
base64 = "0.13.0"
bytes = "1.0.1"
form_urlencoded = "1.0.0"
itoa = "0.4.6"
itoa = "1.0.1"
js_int = { version = "0.2.0", features = ["serde"] }
ruma-serde-macros = { version = "=0.5.0", path = "../ruma-serde-macros" }
serde = { version = "1.0.118", features = ["derive"] }

View File

@ -198,9 +198,8 @@ impl<S: Sink> PartSerializer<S> {
where
I: itoa::Integer,
{
let mut buf = [b'\0'; 20];
let len = itoa::write(&mut buf[..], value).unwrap();
let part = unsafe { str::from_utf8_unchecked(&buf[0..len]) };
let mut buf = itoa::Buffer::new();
let part = buf.format(value);
ser::Serializer::serialize_str(self, part)
}
}