Skip to content

Commit 4bfe65a

Browse files
authored
refactor(http1): use saturating_sub instead of manual impl (#3983)
1 parent 9da1814 commit 4bfe65a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/proto/h1/role.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ where
9292
/// Used when there was a partial read, to skip full parsing on a
9393
/// a slow connection.
9494
fn is_complete_fast(bytes: &[u8], prev_len: usize) -> bool {
95-
let start = if prev_len < 3 { 0 } else { prev_len - 3 };
95+
let start = prev_len.saturating_sub(3);
9696
let bytes = &bytes[start..];
9797

9898
for (i, b) in bytes.iter().copied().enumerate() {

0 commit comments

Comments
 (0)