Skip to content

Commit c2c399f

Browse files
tisonkunlalitb
andauthored
chore: avoid alloc or fmt when possible (#3183)
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
1 parent 00f97c9 commit c2c399f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

opentelemetry/src/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ impl fmt::Debug for Key {
8181
impl From<Key> for String {
8282
fn from(key: Key) -> Self {
8383
match key.0 {
84-
OtelString::Owned(s) => s.to_string(),
85-
OtelString::Static(s) => s.to_string(),
84+
OtelString::Owned(s) => s.into_string(),
85+
OtelString::Static(s) => s.to_owned(),
8686
OtelString::RefCounted(s) => s.to_string(),
8787
}
8888
}
@@ -268,8 +268,8 @@ impl StringValue {
268268
impl From<StringValue> for String {
269269
fn from(s: StringValue) -> Self {
270270
match s.0 {
271-
OtelString::Owned(s) => s.to_string(),
272-
OtelString::Static(s) => s.to_string(),
271+
OtelString::Owned(s) => s.into_string(),
272+
OtelString::Static(s) => s.to_owned(),
273273
OtelString::RefCounted(s) => s.to_string(),
274274
}
275275
}

0 commit comments

Comments
 (0)