identifiers: Use fewer transmutes for ServerName

This commit is contained in:
Jonas Platte 2021-06-21 12:23:52 +02:00
parent e308c70aa7
commit 59161b842b
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -19,11 +19,11 @@ impl ServerName {
} }
fn from_owned(s: Box<str>) -> Box<Self> { fn from_owned(s: Box<str>) -> Box<Self> {
unsafe { mem::transmute(s) } unsafe { Box::from_raw(Box::into_raw(s) as _) }
} }
fn into_owned(self: Box<Self>) -> Box<str> { fn into_owned(self: Box<Self>) -> Box<str> {
unsafe { mem::transmute(self) } unsafe { Box::from_raw(Box::into_raw(self) as _) }
} }
/// Creates a string slice from this `ServerName`. /// Creates a string slice from this `ServerName`.