Auto merge of #54613 - matthiaskrgr:string_from_inline_53681, r=nagisa
liballoc: mark str.to_owned() and String::from(&str) as #[inline]. Fixes #53681
This commit is contained in:
commit
96cafc53cf
@ -203,6 +203,7 @@ fn borrow(&self) -> &str {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl ToOwned for str {
|
||||
type Owned = String;
|
||||
#[inline]
|
||||
fn to_owned(&self) -> String {
|
||||
unsafe { String::from_utf8_unchecked(self.as_bytes().to_owned()) }
|
||||
}
|
||||
|
@ -2196,6 +2196,7 @@ fn as_ref(&self) -> &[u8] {
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> From<&'a str> for String {
|
||||
#[inline]
|
||||
fn from(s: &'a str) -> String {
|
||||
s.to_owned()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user