Skip to content

Commit e753545

Browse files
author
Ulrik Sverdrup
committed
collections: Allow inlining str::as_bytes and str::slice_unchecked
These are crucial to inline, and are alreary marked inline in libcore. Because neither `impl str {` nor these methods are generic, the explicit attribute is needed.
1 parent 9e4f6b5 commit e753545

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libcollections/str.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,7 @@ impl str {
11531153
/// assert_eq!(s.slice_unchecked(0, 21), "Löwe 老虎 Léopard");
11541154
/// }
11551155
/// ```
1156+
#[inline]
11561157
#[stable(feature = "rust1", since = "1.0.0")]
11571158
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
11581159
core_str::StrExt::slice_unchecked(self, begin, end)
@@ -1462,6 +1463,7 @@ impl str {
14621463
/// ```
14631464
/// assert_eq!("bors".as_bytes(), b"bors");
14641465
/// ```
1466+
#[inline]
14651467
#[stable(feature = "rust1", since = "1.0.0")]
14661468
pub fn as_bytes(&self) -> &[u8] {
14671469
core_str::StrExt::as_bytes(self)

0 commit comments

Comments
 (0)