Skip to content

Commit ce5421a

Browse files
committed
chore: fix clippy warnings
1 parent 473c7ac commit ce5421a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/layer.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ where
881881
.get_mut::<OtelData>()
882882
.map(|data| self.with_started_cx(data, &|cx| cx.clone()))
883883
})
884-
.unwrap_or_else(|| OtelContext::current())
884+
.unwrap_or_else(OtelContext::current)
885885
}
886886
} else {
887887
OtelContext::default()
@@ -1310,28 +1310,32 @@ where
13101310
}) = otel_data
13111311
{
13121312
// Append busy/idle timings when enabled.
1313-
let timings = timings.and_then(|timings| {
1313+
let timings = timings.map(|timings| {
13141314
let busy_ns = Key::new("busy_ns");
13151315
let idle_ns = Key::new("idle_ns");
13161316

1317-
Some(vec![
1317+
vec![
13181318
KeyValue::new(busy_ns, timings.busy),
13191319
KeyValue::new(idle_ns, timings.idle),
1320-
])
1320+
]
13211321
});
13221322

13231323
if let Some(builder) = builder {
13241324
// Don't create the context here just to get a SpanRef since it's costly
13251325
let mut span = builder.start_with_context(&self.tracer, &parent_cx);
1326-
timings.map(|timings| span.set_attributes(timings));
1326+
if let Some(timings) = timings {
1327+
span.set_attributes(timings)
1328+
};
13271329
if let Some(end_time) = end_time {
13281330
span.end_with_timestamp(end_time);
13291331
} else {
13301332
span.end();
13311333
}
13321334
} else {
13331335
let span = parent_cx.span();
1334-
timings.map(|timings| span.set_attributes(timings));
1336+
if let Some(timings) = timings {
1337+
span.set_attributes(timings)
1338+
};
13351339
end_time.map_or_else(|| span.end(), |end_time| span.end_with_timestamp(end_time));
13361340
};
13371341
}

0 commit comments

Comments
 (0)