Skip to content

Commit c9ff30b

Browse files
authored
Fix trace utils clippy warning (#1397)
Fix trace utils clippy warning Co-authored-by: gyuheon.oh <gyuheon.oh@datadoghq.com>
1 parent 435107c commit c9ff30b

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

libdd-trace-utils/src/trace_utils.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -532,21 +532,20 @@ pub fn enrich_span_with_google_cloud_function_metadata(
532532
todo!()
533533
};
534534

535-
#[allow(clippy::unwrap_used)]
536-
if function.is_some() && !region.is_empty() && !project.is_empty() {
537-
let resource_name = format!(
538-
"projects/{}/locations/{}/functions/{}",
539-
project,
540-
region,
541-
function.unwrap()
542-
);
535+
if let Some(function) = function {
536+
if !region.is_empty() && !project.is_empty() {
537+
let resource_name = format!(
538+
"projects/{}/locations/{}/functions/{}",
539+
project, region, function
540+
);
543541

544-
span.meta
545-
.insert("gcrfx.location".to_string(), region.to_string());
546-
span.meta
547-
.insert("gcrfx.project_id".to_string(), project.to_string());
548-
span.meta
549-
.insert("gcrfx.resource_name".to_string(), resource_name.to_string());
542+
span.meta
543+
.insert("gcrfx.location".to_string(), region.to_string());
544+
span.meta
545+
.insert("gcrfx.project_id".to_string(), project.to_string());
546+
span.meta
547+
.insert("gcrfx.resource_name".to_string(), resource_name.to_string());
548+
}
550549
}
551550
}
552551

0 commit comments

Comments
 (0)