style: Miscellaneous Servo build fixes.

This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 16:50:40 +01:00
parent 18cda1567a
commit e227715aee
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
12 changed files with 59 additions and 10 deletions

View file

@ -38,6 +38,34 @@ impl DerefMut for OwnedStr {
}
}
impl OwnedStr {
/// Convert the OwnedStr into a boxed str.
#[inline]
pub fn into_box(self) -> Box<str> {
self.into_string().into_boxed_str()
}
/// Convert the OwnedStr into a `String`.
#[inline]
pub fn into_string(self) -> String {
unsafe { String::from_utf8_unchecked(self.0.into_vec()) }
}
}
impl From<OwnedStr> for String {
#[inline]
fn from(b: OwnedStr) -> Self {
b.into_string()
}
}
impl From<OwnedStr> for Box<str> {
#[inline]
fn from(b: OwnedStr) -> Self {
b.into_box()
}
}
impl From<Box<str>> for OwnedStr {
#[inline]
fn from(b: Box<str>) -> Self {