Skip to content

Commit a68ae32

Browse files
committed
Stabilize byte_slice_trim_ascii for &[u8]/&str
Remove feature from documentation examples Update intra-doc link for `u8::is_ascii_whitespace` on `&[u8]` functions
1 parent 6f7e00a commit a68ae32

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

library/core/src/slice/ascii.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ impl [u8] {
114114
/// Returns a byte slice with leading ASCII whitespace bytes removed.
115115
///
116116
/// 'Whitespace' refers to the definition used by
117-
/// `u8::is_ascii_whitespace`.
117+
/// [`u8::is_ascii_whitespace`].
118+
///
119+
/// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace
118120
///
119121
/// # Examples
120122
///
121123
/// ```
122-
/// #![feature(byte_slice_trim_ascii)]
123-
///
124124
/// assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n");
125125
/// assert_eq!(b" ".trim_ascii_start(), b"");
126126
/// assert_eq!(b"".trim_ascii_start(), b"");
127127
/// ```
128-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
128+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
129129
#[inline]
130130
pub const fn trim_ascii_start(&self) -> &[u8] {
131131
let mut bytes = self;
@@ -144,18 +144,18 @@ impl [u8] {
144144
/// Returns a byte slice with trailing ASCII whitespace bytes removed.
145145
///
146146
/// 'Whitespace' refers to the definition used by
147-
/// `u8::is_ascii_whitespace`.
147+
/// [`u8::is_ascii_whitespace`].
148+
///
149+
/// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace
148150
///
149151
/// # Examples
150152
///
151153
/// ```
152-
/// #![feature(byte_slice_trim_ascii)]
153-
///
154154
/// assert_eq!(b"\r hello world\n ".trim_ascii_end(), b"\r hello world");
155155
/// assert_eq!(b" ".trim_ascii_end(), b"");
156156
/// assert_eq!(b"".trim_ascii_end(), b"");
157157
/// ```
158-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
158+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
159159
#[inline]
160160
pub const fn trim_ascii_end(&self) -> &[u8] {
161161
let mut bytes = self;
@@ -175,18 +175,18 @@ impl [u8] {
175175
/// removed.
176176
///
177177
/// 'Whitespace' refers to the definition used by
178-
/// `u8::is_ascii_whitespace`.
178+
/// [`u8::is_ascii_whitespace`].
179+
///
180+
/// [`u8::is_ascii_whitespace`]: u8::is_ascii_whitespace
179181
///
180182
/// # Examples
181183
///
182184
/// ```
183-
/// #![feature(byte_slice_trim_ascii)]
184-
///
185185
/// assert_eq!(b"\r hello world\n ".trim_ascii(), b"hello world");
186186
/// assert_eq!(b" ".trim_ascii(), b"");
187187
/// assert_eq!(b"".trim_ascii(), b"");
188188
/// ```
189-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
189+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
190190
#[inline]
191191
pub const fn trim_ascii(&self) -> &[u8] {
192192
self.trim_ascii_start().trim_ascii_end()

library/core/src/str/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,13 +2531,11 @@ impl str {
25312531
/// # Examples
25322532
///
25332533
/// ```
2534-
/// #![feature(byte_slice_trim_ascii)]
2535-
///
25362534
/// assert_eq!(" \t \u{3000}hello world\n".trim_ascii_start(), "\u{3000}hello world\n");
25372535
/// assert_eq!(" ".trim_ascii_start(), "");
25382536
/// assert_eq!("".trim_ascii_start(), "");
25392537
/// ```
2540-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
2538+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
25412539
#[must_use = "this returns the trimmed string as a new slice, \
25422540
without modifying the original"]
25432541
#[inline]
@@ -2557,13 +2555,11 @@ impl str {
25572555
/// # Examples
25582556
///
25592557
/// ```
2560-
/// #![feature(byte_slice_trim_ascii)]
2561-
///
25622558
/// assert_eq!("\r hello world\u{3000}\n ".trim_ascii_end(), "\r hello world\u{3000}");
25632559
/// assert_eq!(" ".trim_ascii_end(), "");
25642560
/// assert_eq!("".trim_ascii_end(), "");
25652561
/// ```
2566-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
2562+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
25672563
#[must_use = "this returns the trimmed string as a new slice, \
25682564
without modifying the original"]
25692565
#[inline]
@@ -2584,13 +2580,11 @@ impl str {
25842580
/// # Examples
25852581
///
25862582
/// ```
2587-
/// #![feature(byte_slice_trim_ascii)]
2588-
///
25892583
/// assert_eq!("\r hello world\n ".trim_ascii(), "hello world");
25902584
/// assert_eq!(" ".trim_ascii(), "");
25912585
/// assert_eq!("".trim_ascii(), "");
25922586
/// ```
2593-
#[unstable(feature = "byte_slice_trim_ascii", issue = "94035")]
2587+
#[stable(feature = "byte_slice_trim_ascii", since = "CURRENT_RUSTC_VERSION")]
25942588
#[must_use = "this returns the trimmed string as a new slice, \
25952589
without modifying the original"]
25962590
#[inline]

0 commit comments

Comments
 (0)