diff --git a/linkerd/http/retry/src/lib.rs b/linkerd/http/retry/src/lib.rs index 6a77539d23..5c47cc2c64 100644 --- a/linkerd/http/retry/src/lib.rs +++ b/linkerd/http/retry/src/lib.rs @@ -268,13 +268,11 @@ async fn send_req_with_retries( tracing::trace!("Success on first attempt"); return result.map(|rsp| rsp.map(BoxBody::new)); } - match backup.body().is_capped() { - // The body completely fit into the retry buffer, so we can retry. - Some(false) => {} + if matches!(backup.body().is_capped(), None | Some(true)) { // The body was either too large, or we received an early response // before the request body was completed read. We cannot safely // attempt to send this request again. - None | Some(true) => return result.map(|rsp| rsp.map(BoxBody::new)), + return result.map(|rsp| rsp.map(BoxBody::new)); } // The response was retryable, so continue trying to dispatch backup @@ -305,9 +303,8 @@ async fn send_req_with_retries( tracing::debug!("Retry success"); return result.map(|rsp| rsp.map(BoxBody::new)); } - match backup.body().is_capped() { - Some(false) => {} - None | Some(true) => return result.map(|rsp| rsp.map(BoxBody::new)), + if matches!(backup.body().is_capped(), None | Some(true)) { + return result.map(|rsp| rsp.map(BoxBody::new)); } }