Skip to content

Commit d6e7d46

Browse files
Improve builder::str::inner::Inner::into_string implementation
Since `Inner::into_string` already takes ownership of `self` we can avoid unnecessary copy and allocation by moving `Box<str>` and using its implementation of `Into<String>`.
1 parent ad5d676 commit d6e7d46

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/builder/str.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ pub(crate) mod inner {
246246
}
247247

248248
pub(crate) fn into_string(self) -> String {
249-
self.as_str().to_owned()
249+
match self {
250+
Self::Static(s) => s.to_owned(),
251+
Self::Owned(s) => s.into(),
252+
}
250253
}
251254
}
252255
}

0 commit comments

Comments
 (0)