From c32a23bf63e04d1f8eaab6f7b680addd90f3ac51 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 31 Jul 2025 15:22:13 +0200 Subject: [PATCH] fix(snix/tracing): fix clippy::result_large_err lint We still need to unbox before calling ::with_interceptor, the proper fix will be in https://github.com/hyperium/tonic/issues/2253. Change-Id: I6de13de79e8ffd9d2f75268b7b232c2f6c91202d Reviewed-on: https://cl.snix.dev/c/snix/+/30632 Tested-by: besadii Autosubmit: Florian Klink Reviewed-by: Ryan Lahfa --- snix/castore/src/blobservice/grpc.rs | 4 +++- snix/castore/src/directoryservice/grpc.rs | 4 +++- snix/store/src/pathinfoservice/grpc.rs | 4 +++- snix/tracing/src/propagate/tonic.rs | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/snix/castore/src/blobservice/grpc.rs b/snix/castore/src/blobservice/grpc.rs index 5c3474309..92403c38a 100644 --- a/snix/castore/src/blobservice/grpc.rs +++ b/snix/castore/src/blobservice/grpc.rs @@ -217,7 +217,9 @@ impl ServiceBuilder for GRPCBlobServiceConfig { ) -> Result, Box> { let client = proto::blob_service_client::BlobServiceClient::with_interceptor( crate::tonic::channel_from_url(&self.url.parse()?).await?, - snix_tracing::propagate::tonic::send_trace, + // tonic::service::Interceptor wants an unboxed Status as return type. + // https://github.com/hyperium/tonic/issues/2253 + |rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e), ); Ok(Arc::new(GRPCBlobService::from_client( instance_name.to_string(), diff --git a/snix/castore/src/directoryservice/grpc.rs b/snix/castore/src/directoryservice/grpc.rs index d85e08483..6a72e99e9 100644 --- a/snix/castore/src/directoryservice/grpc.rs +++ b/snix/castore/src/directoryservice/grpc.rs @@ -245,7 +245,9 @@ impl ServiceBuilder for GRPCDirectoryServiceConfig { ) -> Result, Box> { let client = proto::directory_service_client::DirectoryServiceClient::with_interceptor( crate::tonic::channel_from_url(&self.url.parse()?).await?, - snix_tracing::propagate::tonic::send_trace, + // tonic::service::Interceptor wants an unboxed Status as return type. + // https://github.com/hyperium/tonic/issues/2253 + |rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e), ); Ok(Arc::new(GRPCDirectoryService::from_client( instance_name.to_string(), diff --git a/snix/store/src/pathinfoservice/grpc.rs b/snix/store/src/pathinfoservice/grpc.rs index 79e99d927..a648abbbc 100644 --- a/snix/store/src/pathinfoservice/grpc.rs +++ b/snix/store/src/pathinfoservice/grpc.rs @@ -175,7 +175,9 @@ impl ServiceBuilder for GRPCPathInfoServiceConfig { ) -> Result, Box> { let client = proto::path_info_service_client::PathInfoServiceClient::with_interceptor( snix_castore::tonic::channel_from_url(&self.url.parse()?).await?, - snix_tracing::propagate::tonic::send_trace, + // tonic::service::Interceptor wants an unboxed Status as return type. + // https://github.com/hyperium/tonic/issues/2253 + |rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e), ); Ok(Arc::new(GRPCPathInfoService::from_client( instance_name.to_string(), diff --git a/snix/tracing/src/propagate/tonic.rs b/snix/tracing/src/propagate/tonic.rs index 75455c056..e7f3cc030 100644 --- a/snix/tracing/src/propagate/tonic.rs +++ b/snix/tracing/src/propagate/tonic.rs @@ -45,7 +45,9 @@ impl Injector for MetadataInjector<'_> { /// Trace context propagation: send the trace context by injecting it into the metadata of the given /// request. This only injects the current span if the otlp feature is also enabled. #[allow(unused_mut)] -pub fn send_trace(mut request: tonic::Request) -> Result, tonic::Status> { +pub fn send_trace( + mut request: tonic::Request, +) -> Result, Box> { #[cfg(feature = "otlp")] { global::get_text_map_propagator(|propagator| {