Skip to content

Commit e1e1ae5

Browse files
committed
Optimize unix::Client::new: Avoid multi write
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent b38aa02 commit e1e1ae5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/unix.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ impl Client {
2525
let client = unsafe { Client::mk()? };
2626
// I don't think the character written here matters, but I could be
2727
// wrong!
28-
for _ in 0..limit {
29-
(&client.write).write_all(&[b'|'])?;
30-
}
28+
let v: Vec<u8> = vec![b'|'; limit];
29+
(&client.write).write_all(&v)?;
3130
Ok(client)
3231
}
3332

0 commit comments

Comments
 (0)