diff --git a/crates/core/src/conn/quinn/builder.rs b/crates/core/src/conn/quinn/builder.rs index 9acd62a96..0dbf48308 100644 --- a/crates/core/src/conn/quinn/builder.rs +++ b/crates/core/src/conn/quinn/builder.rs @@ -175,11 +175,9 @@ async fn process_web_transport( if let Err(e) = stream.send_data(frame.into_data().unwrap_or_default()).await { tracing::error!(error = ?e, "unable to send data to connection peer"); } - } else { - if let Err(e) = stream.send_trailers(frame.into_trailers().unwrap_or_default()).await { + } else if let Err(e) = stream.send_trailers(frame.into_trailers().unwrap_or_default()).await { tracing::error!(error = ?e, "unable to send trailers to connection peer"); } - } } Err(e) => { tracing::error!(error = ?e, "unable to poll data from connection"); @@ -231,11 +229,9 @@ where if let Err(e) = tx.send_data(frame.into_data().unwrap_or_default()).await { tracing::error!(error = ?e, "unable to send data to connection peer"); } - } else { - if let Err(e) = tx.send_trailers(frame.into_trailers().unwrap_or_default()).await { + } else if let Err(e) = tx.send_trailers(frame.into_trailers().unwrap_or_default()).await { tracing::error!(error = ?e, "unable to send trailers to connection peer"); } - } } Err(e) => { tracing::error!(error = ?e, "unable to poll data from connection"); diff --git a/crates/core/src/tower_compat.rs b/crates/core/src/tower_compat.rs index a234697f7..569ae8782 100644 --- a/crates/core/src/tower_compat.rs +++ b/crates/core/src/tower_compat.rs @@ -55,7 +55,7 @@ where { async fn handle(&self, req: &mut Request, _depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) { let mut svc = self.0.clone(); - if let Err(_) = svc.ready().await { + if svc.ready().await.is_err() { tracing::error!("tower service not ready."); res.render(StatusError::internal_server_error().cause("tower service not ready.")); return; @@ -192,7 +192,7 @@ where { async fn handle(&self, req: &mut Request, depot: &mut Depot, res: &mut Response, ctrl: &mut FlowCtrl) { let mut svc = self.0.clone(); - if let Err(_) = svc.ready().await { + if svc.ready().await.is_err() { tracing::error!("tower service not ready."); res.render(StatusError::internal_server_error().cause("tower service not ready.")); return;