From 92030deaea4e2dcdb2e0d57f43e336df75841f56 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 25 Nov 2025 16:05:49 -0500 Subject: [PATCH] refactor(http1): use saturating_sub instead of manual impl --- src/proto/h1/role.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs index b7aedbcd88..f124c9ff2b 100644 --- a/src/proto/h1/role.rs +++ b/src/proto/h1/role.rs @@ -92,7 +92,7 @@ where /// Used when there was a partial read, to skip full parsing on a /// a slow connection. fn is_complete_fast(bytes: &[u8], prev_len: usize) -> bool { - let start = if prev_len < 3 { 0 } else { prev_len - 3 }; + let start = prev_len.saturating_sub(3); let bytes = &bytes[start..]; for (i, b) in bytes.iter().copied().enumerate() {