mirror of https://github.com/fafhrd91/actix-net
perf(bytestring): prefer `from_utf8_unchecked` (#864)
This commit is contained in:
parent
8b19fa1de3
commit
668c9c0a8a
|
|
@ -185,7 +185,8 @@ impl From<Box<str>> for ByteString {
|
||||||
impl From<ByteString> for String {
|
impl From<ByteString> for String {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(value: ByteString) -> Self {
|
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()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue