Skip to content

Commit 3f075ea

Browse files
committed
Removed match on span lookup and use ? operator
1 parent 92b73da commit 3f075ea

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/lib.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -410,21 +410,16 @@ where
410410
where
411411
S: Subscriber + for<'span> LookupSpan<'span>,
412412
{
413-
match ctx.span(id) {
414-
// if the event is in a span, get the span's starting point.
415-
Some(ctx) => {
416-
let ext = ctx.extensions();
417-
let data = ext
418-
.get::<Data>()
419-
.expect("Data cannot be found in extensions");
420-
421-
if self.config.higher_precision {
422-
Some(self.format_timestamp_with_decimals(data.start))
423-
} else {
424-
Some(self.format_timestamp(data.start))
425-
}
426-
}
427-
None => None,
413+
let ctx = ctx.span(id)?;
414+
let ext = ctx.extensions();
415+
let data = ext
416+
.get::<Data>()
417+
.expect("Data cannot be found in extensions");
418+
419+
if self.config.higher_precision {
420+
Some(self.format_timestamp_with_decimals(data.start))
421+
} else {
422+
Some(self.format_timestamp(data.start))
428423
}
429424
}
430425

0 commit comments

Comments
 (0)