@@ -881,7 +881,7 @@ where
881
881
. get_mut :: < OtelData > ( )
882
882
. map ( |data| self . with_started_cx ( data, & |cx| cx. clone ( ) ) )
883
883
} )
884
- . unwrap_or_else ( || OtelContext :: current ( ) )
884
+ . unwrap_or_else ( OtelContext :: current)
885
885
}
886
886
} else {
887
887
OtelContext :: default ( )
@@ -1310,28 +1310,32 @@ where
1310
1310
} ) = otel_data
1311
1311
{
1312
1312
// Append busy/idle timings when enabled.
1313
- let timings = timings. and_then ( |timings| {
1313
+ let timings = timings. map ( |timings| {
1314
1314
let busy_ns = Key :: new ( "busy_ns" ) ;
1315
1315
let idle_ns = Key :: new ( "idle_ns" ) ;
1316
1316
1317
- Some ( vec ! [
1317
+ vec ! [
1318
1318
KeyValue :: new( busy_ns, timings. busy) ,
1319
1319
KeyValue :: new( idle_ns, timings. idle) ,
1320
- ] )
1320
+ ]
1321
1321
} ) ;
1322
1322
1323
1323
if let Some ( builder) = builder {
1324
1324
// Don't create the context here just to get a SpanRef since it's costly
1325
1325
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
+ } ;
1327
1329
if let Some ( end_time) = end_time {
1328
1330
span. end_with_timestamp ( end_time) ;
1329
1331
} else {
1330
1332
span. end ( ) ;
1331
1333
}
1332
1334
} else {
1333
1335
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
+ } ;
1335
1339
end_time. map_or_else ( || span. end ( ) , |end_time| span. end_with_timestamp ( end_time) ) ;
1336
1340
} ;
1337
1341
}
0 commit comments