Skip to content

Commit 76daca2

Browse files
committed
Add #[inline] to some core::str functions.
Almost all these functions already had #[inline]. These were missing.
1 parent 7a25123 commit 76daca2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

library/core/src/str/iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ unsafe impl TrustedLen for Bytes<'_> {}
326326
#[doc(hidden)]
327327
#[unstable(feature = "trusted_random_access", issue = "none")]
328328
unsafe impl TrustedRandomAccess for Bytes<'_> {
329+
#[inline]
329330
fn may_have_side_effect() -> bool {
330331
false
331332
}

library/core/src/str/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,6 +1711,7 @@ impl str {
17111711
///
17121712
/// assert_eq!("Hello\tworld", s.trim());
17131713
/// ```
1714+
#[inline]
17141715
#[must_use = "this returns the trimmed string as a slice, \
17151716
without modifying the original"]
17161717
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1748,6 +1749,7 @@ impl str {
17481749
/// let s = " עברית ";
17491750
/// assert!(Some('ע') == s.trim_start().chars().next());
17501751
/// ```
1752+
#[inline]
17511753
#[must_use = "this returns the trimmed string as a new slice, \
17521754
without modifying the original"]
17531755
#[stable(feature = "trim_direction", since = "1.30.0")]
@@ -1785,6 +1787,7 @@ impl str {
17851787
/// let s = " עברית ";
17861788
/// assert!(Some('ת') == s.trim_end().chars().rev().next());
17871789
/// ```
1790+
#[inline]
17881791
#[must_use = "this returns the trimmed string as a new slice, \
17891792
without modifying the original"]
17901793
#[stable(feature = "trim_direction", since = "1.30.0")]
@@ -1823,6 +1826,7 @@ impl str {
18231826
/// let s = " עברית";
18241827
/// assert!(Some('ע') == s.trim_left().chars().next());
18251828
/// ```
1829+
#[inline]
18261830
#[stable(feature = "rust1", since = "1.0.0")]
18271831
#[rustc_deprecated(
18281832
since = "1.33.0",
@@ -1864,6 +1868,7 @@ impl str {
18641868
/// let s = "עברית ";
18651869
/// assert!(Some('ת') == s.trim_right().chars().rev().next());
18661870
/// ```
1871+
#[inline]
18671872
#[stable(feature = "rust1", since = "1.0.0")]
18681873
#[rustc_deprecated(
18691874
since = "1.33.0",
@@ -2261,6 +2266,7 @@ impl str {
22612266
/// assert_eq!("GRüßE, JüRGEN ❤", s);
22622267
/// ```
22632268
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
2269+
#[inline]
22642270
pub fn make_ascii_uppercase(&mut self) {
22652271
// SAFETY: safe because we transmute two types with the same layout.
22662272
let me = unsafe { self.as_bytes_mut() };
@@ -2287,6 +2293,7 @@ impl str {
22872293
/// assert_eq!("grÜße, jÜrgen ❤", s);
22882294
/// ```
22892295
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
2296+
#[inline]
22902297
pub fn make_ascii_lowercase(&mut self) {
22912298
// SAFETY: safe because we transmute two types with the same layout.
22922299
let me = unsafe { self.as_bytes_mut() };

0 commit comments

Comments
 (0)