From 3b04b8299881248cd0f888ffed496dd15008e7ca Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sun, 12 Jan 2025 14:27:46 +0100 Subject: [PATCH] chore(clippy): cleanup --- instrumentation/src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/instrumentation/src/lib.rs b/instrumentation/src/lib.rs index 31df7f6..fd69950 100644 --- a/instrumentation/src/lib.rs +++ b/instrumentation/src/lib.rs @@ -96,20 +96,18 @@ pub fn init_tracing(otel_endpoint: Option<&String>, log_stderr: bool) -> Result< None => None, }; - let metrics_layer = match meter_provider { - Some(ref p) => Some(MetricsLayer::new(p.to_owned())), - None => None, - }; + let metrics_layer = meter_provider + .as_ref() + .map(|p| MetricsLayer::new(p.to_owned())); let tracer_provider = match otel_endpoint { Some(endpoint) => Some(init_tracer_provider(endpoint, resource)?), None => None, }; - let trace_layer = match tracer_provider { - Some(ref p) => Some(OpenTelemetryLayer::new(p.tracer("tracing-otel-subscriber"))), - None => None, - }; + let trace_layer = tracer_provider + .as_ref() + .map(|p| OpenTelemetryLayer::new(p.tracer("tracing-otel-subscriber"))); opentelemetry::global::set_text_map_propagator(TraceContextPropagator::new());