1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

reduce unsafe (#1972)

This commit is contained in:
fakeshadow
2021-02-10 15:11:12 -08:00
committed by GitHub
parent ea5ce3befb
commit d9d0d1d1a2
3 changed files with 77 additions and 131 deletions

View File

@ -309,11 +309,8 @@ where
}
}
// SAFETY: setting length to 0 is safe
// skips one length check vs truncate
unsafe {
write_buf.set_len(0);
}
// everything has written to io. clear buffer.
write_buf.clear();
// flush the io and check if get blocked.
let blocked = io.poll_flush(cx)?.is_pending();