Skip to content

Commit 7b400fe

Browse files
committed
Remove an additional allocation
1 parent 9612c3b commit 7b400fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ pub async fn encode(req: Request) -> Result<Encoder, std::io::Error> {
8080
}
8181

8282
let date = fmt_http_date(std::time::SystemTime::now());
83-
let val = format!("Date: {}\r\n", date);
84-
buf.write_all(val.as_bytes()).await?;
83+
buf.write_all(b"Date: ").await?;
84+
buf.write_all(date.as_bytes()).await?;
85+
buf.write_all(b"\r\n").await?;
8586

8687
for (header, values) in req.iter() {
8788
for value in values.iter() {

0 commit comments

Comments
 (0)