From fd02db436a745cd584684a60a9e0e97de813c50f Mon Sep 17 00:00:00 2001 From: Kirill Ivanov Date: Fri, 16 Aug 2024 10:55:42 +0300 Subject: [PATCH] clippy --- .../blockscout-service-launcher/src/launcher/span_builder.rs | 4 ++-- .../src/tracing/request_id_layer.rs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/blockscout-service-launcher/src/launcher/span_builder.rs b/libs/blockscout-service-launcher/src/launcher/span_builder.rs index a000d9b58..24bce5667 100644 --- a/libs/blockscout-service-launcher/src/launcher/span_builder.rs +++ b/libs/blockscout-service-launcher/src/launcher/span_builder.rs @@ -92,8 +92,8 @@ fn handle_error(span: Span, status_code: StatusCode, response_error: &dyn Respon // pre-formatting errors is a workaround for https://github.com/tokio-rs/tracing/issues/1565 let display = format!("{response_error}"); let debug = format!("{response_error:?}"); - span.record("exception.message", &tracing::field::display(display)); - span.record("exception.details", &tracing::field::display(debug)); + span.record("exception.message", tracing::field::display(display)); + span.record("exception.details", tracing::field::display(debug)); let code: i32 = status_code.as_u16().into(); span.record("http.status_code", code); diff --git a/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs b/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs index 92627e0dc..8c2e0b3c3 100644 --- a/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs +++ b/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs @@ -186,13 +186,14 @@ mod tests { } fn parse_json(s: &str) -> serde_json::Value { - serde_json::from_str::(&s).expect(&format!("failed to parse '{}'", s)) + serde_json::from_str::(s) + .unwrap_or_else(|_| panic!("failed to parse '{}'", s)) } fn parse_captured_logs(logs: String) -> Vec { logs.split('\n') .filter(|l| !l.is_empty()) - .map(|l| parse_json(l)) + .map(parse_json) .collect() }