diff --git a/crates/kitsune-core/src/mapping/mastodon/sealed.rs b/crates/kitsune-core/src/mapping/mastodon/sealed.rs index e5c6a59ec..51d3cbaca 100644 --- a/crates/kitsune-core/src/mapping/mastodon/sealed.rs +++ b/crates/kitsune-core/src/mapping/mastodon/sealed.rs @@ -43,7 +43,7 @@ use scoped_futures::ScopedFutureExt; use serde::{de::DeserializeOwned, Serialize}; use smol_str::SmolStr; use speedy_uuid::Uuid; -use std::str::FromStr; +use std::{fmt::Write, str::FromStr}; #[derive(Clone, Copy)] pub struct MapperState<'a> { @@ -103,8 +103,7 @@ impl IntoMastodon for DbAccount { let mut acct = self.username.clone(); if !self.local { - acct.push('@'); - acct.push_str(&self.domain); + let _ = write!(acct, "@{}", self.domain); } let avatar = if let Some(avatar_id) = self.avatar_id { diff --git a/crates/kitsune-http-signatures/src/header.rs b/crates/kitsune-http-signatures/src/header.rs index cfcdfa489..2e7db914d 100644 --- a/crates/kitsune-http-signatures/src/header.rs +++ b/crates/kitsune-http-signatures/src/header.rs @@ -3,6 +3,7 @@ use derive_builder::Builder; use http::{header::DATE, request::Parts}; use std::{ cmp::min, + fmt::Write, time::{Duration, SystemTime, SystemTimeError}, }; use time::{format_description::well_known::Rfc2822, OffsetDateTime}; @@ -130,19 +131,23 @@ impl TryFrom> for String { ); if let Some(algorithm) = value.algorithm { - signature_header.push_str(",algorithm=\""); - signature_header.push_str(algorithm); - signature_header.push('"'); + let _ = write!(signature_header, ",algorithm=\"{algorithm}\""); } if let Some(created) = value.created { - signature_header.push_str(",created="); - signature_header.push_str(&created.to_unix_timestamp()?.to_string()); + let _ = write!( + signature_header, + ",created={}", + created.to_unix_timestamp()? + ); } if let Some(expires) = value.expires { - signature_header.push_str(",expires="); - signature_header.push_str(&expires.to_unix_timestamp()?.to_string()); + let _ = write!( + signature_header, + ",expires={}", + expires.to_unix_timestamp()? + ); } Ok(signature_header)