diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-10-18 15:39:09 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-10-18 15:39:09 +0200 |
| commit | 76daca2791f3deeee925e449d7db51795f55121d (patch) | |
| tree | a38a01704622111cfa403a78fe0d7199d3ac1e88 | |
| parent | 7a25123845778fdaa715815cc9ec917a67c35dbd (diff) | |
| download | rust-76daca2791f3deeee925e449d7db51795f55121d.tar.gz rust-76daca2791f3deeee925e449d7db51795f55121d.zip | |
Add #[inline] to some core::str functions.
Almost all these functions already had #[inline]. These were missing.
| -rw-r--r-- | library/core/src/str/iter.rs | 1 | ||||
| -rw-r--r-- | library/core/src/str/mod.rs | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index bee86df520c..28cd350019e 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -326,6 +326,7 @@ unsafe impl TrustedLen for Bytes<'_> {} #[doc(hidden)] #[unstable(feature = "trusted_random_access", issue = "none")] unsafe impl TrustedRandomAccess for Bytes<'_> { + #[inline] fn may_have_side_effect() -> bool { false } diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 3e18a4e7062..5d80d2be9a4 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1711,6 +1711,7 @@ impl str { /// /// assert_eq!("Hello\tworld", s.trim()); /// ``` + #[inline] #[must_use = "this returns the trimmed string as a slice, \ without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1748,6 +1749,7 @@ impl str { /// let s = " עברית "; /// assert!(Some('ע') == s.trim_start().chars().next()); /// ``` + #[inline] #[must_use = "this returns the trimmed string as a new slice, \ without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] @@ -1785,6 +1787,7 @@ impl str { /// let s = " עברית "; /// assert!(Some('ת') == s.trim_end().chars().rev().next()); /// ``` + #[inline] #[must_use = "this returns the trimmed string as a new slice, \ without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] @@ -1823,6 +1826,7 @@ impl str { /// let s = " עברית"; /// assert!(Some('ע') == s.trim_left().chars().next()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated( since = "1.33.0", @@ -1864,6 +1868,7 @@ impl str { /// let s = "עברית "; /// assert!(Some('ת') == s.trim_right().chars().rev().next()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated( since = "1.33.0", @@ -2261,6 +2266,7 @@ impl str { /// assert_eq!("GRüßE, JüRGEN ❤", s); /// ``` #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] + #[inline] pub fn make_ascii_uppercase(&mut self) { // SAFETY: safe because we transmute two types with the same layout. let me = unsafe { self.as_bytes_mut() }; @@ -2287,6 +2293,7 @@ impl str { /// assert_eq!("grÜße, jÜrgen ❤", s); /// ``` #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] + #[inline] pub fn make_ascii_lowercase(&mut self) { // SAFETY: safe because we transmute two types with the same layout. let me = unsafe { self.as_bytes_mut() }; |
