diff options
| author | bors <bors@rust-lang.org> | 2018-10-09 19:57:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-09 19:57:55 +0000 |
| commit | 96cafc53cfc6667a03c8e77d8e0a2fc96555ff6b (patch) | |
| tree | e4ca21e23facc7cf460eb461eaabdd939ad943c4 /src/liballoc | |
| parent | 0e07c4281c343e9e15a0a8fca79538ad1a8eb513 (diff) | |
| parent | d24070bf8d58f40887b4b33f63c1c3d3df55c346 (diff) | |
| download | rust-96cafc53cfc6667a03c8e77d8e0a2fc96555ff6b.tar.gz rust-96cafc53cfc6667a03c8e77d8e0a2fc96555ff6b.zip | |
Auto merge of #54613 - matthiaskrgr:string_from_inline_53681, r=nagisa
liballoc: mark str.to_owned() and String::from(&str) as #[inline]. Fixes #53681
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/str.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/string.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 2af89562d69..9916fa639e1 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -203,6 +203,7 @@ impl Borrow<str> for String { #[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()) } } diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 837e17cf640..ab3f8fc2707 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -2196,6 +2196,7 @@ impl AsRef<[u8]> for String { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> From<&'a str> for String { + #[inline] fn from(s: &'a str) -> String { s.to_owned() } |
