perf(bytestring): prefer `from_utf8_unchecked` (#864)

This commit is contained in:
Yuki Okushi 2026-04-22 00:30:10 +09:00 committed by GitHub
parent 8b19fa1de3
commit 668c9c0a8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -185,7 +185,8 @@ impl From<Box<str>> for ByteString {
impl From<ByteString> for String {
#[inline]
fn from(value: ByteString) -> Self {
String::from_utf8(value.0.into()).expect("ByteString invariant violated")
// SAFETY: UTF-8 validity is guaranteed during construction.
unsafe { String::from_utf8_unchecked(value.0.into()) }
}
}