Skip to content

Commit 1149861

Browse files
committed
use more idiomatic match
1 parent fbe687a commit 1149861

File tree

1 file changed

+6
-9
lines changed
  • opentelemetry-appender-tracing/src

1 file changed

+6
-9
lines changed

opentelemetry-appender-tracing/src/layer.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,12 @@ impl<LR: LogRecord> tracing::field::Visit for EventVisitor<'_, LR> {
121121
if is_duplicated_metadata(field.name()) {
122122
return;
123123
}
124-
match i64::try_from(value) {
125-
Ok(signed) => {
126-
self.log_record
127-
.add_attribute(Key::new(field.name()), AnyValue::from(signed));
128-
}
129-
Err(_) => {
130-
self.log_record
131-
.add_attribute(Key::new(field.name()), AnyValue::from(format!("{value:?}")));
132-
}
124+
if let Ok(signed) = i64::try_from(value) {
125+
self.log_record
126+
.add_attribute(Key::new(field.name()), AnyValue::from(signed));
127+
} else {
128+
self.log_record
129+
.add_attribute(Key::new(field.name()), AnyValue::from(format!("{value:?}")));
133130
}
134131
}
135132

0 commit comments

Comments
 (0)