Skip to content

Commit 3e10ffc

Browse files
committed
Make features stable and clarify examples
1 parent 33067ad commit 3e10ffc

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

src/liballoc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#![feature(unboxed_closures)]
2626
#![feature(exact_chunks)]
2727
#![feature(repeat_generic_slice)]
28-
#![feature(trim_direction)]
2928

3029
extern crate alloc_system;
3130
extern crate core;

src/libcore/str/mod.rs

+8-22
Original file line numberDiff line numberDiff line change
@@ -3604,24 +3604,20 @@ impl str {
36043604
/// Basic usage:
36053605
///
36063606
/// ```
3607-
/// #![feature(trim_direction)]
3608-
///
36093607
/// let s = " Hello\tworld\t";
36103608
/// assert_eq!("Hello\tworld\t", s.trim_start());
36113609
/// ```
36123610
///
36133611
/// Directionality:
36143612
///
36153613
/// ```
3616-
/// #![feature(trim_direction)]
3617-
///
3618-
/// let s = " English";
3614+
/// let s = " English ";
36193615
/// assert!(Some('E') == s.trim_start().chars().next());
36203616
///
3621-
/// let s = " עברית";
3617+
/// let s = " עברית ";
36223618
/// assert!(Some('ע') == s.trim_start().chars().next());
36233619
/// ```
3624-
#[unstable(feature = "trim_direction", issue = "30459")]
3620+
#[stable(feature = "trim_direction", since = "1.30.0")]
36253621
pub fn trim_start(&self) -> &str {
36263622
self.trim_start_matches(|c: char| c.is_whitespace())
36273623
}
@@ -3643,24 +3639,20 @@ impl str {
36433639
/// Basic usage:
36443640
///
36453641
/// ```
3646-
/// #![feature(trim_direction)]
3647-
///
36483642
/// let s = " Hello\tworld\t";
36493643
/// assert_eq!(" Hello\tworld", s.trim_end());
36503644
/// ```
36513645
///
36523646
/// Directionality:
36533647
///
36543648
/// ```
3655-
/// #![feature(trim_direction)]
3656-
///
3657-
/// let s = "English ";
3649+
/// let s = " English ";
36583650
/// assert!(Some('h') == s.trim_end().chars().rev().next());
36593651
///
3660-
/// let s = "עברית ";
3652+
/// let s = " עברית ";
36613653
/// assert!(Some('ת') == s.trim_end().chars().rev().next());
36623654
/// ```
3663-
#[unstable(feature = "trim_direction", issue = "30459")]
3655+
#[stable(feature = "trim_direction", since = "1.30.0")]
36643656
pub fn trim_end(&self) -> &str {
36653657
self.trim_end_matches(|c: char| c.is_whitespace())
36663658
}
@@ -3805,15 +3797,13 @@ impl str {
38053797
/// Basic usage:
38063798
///
38073799
/// ```
3808-
/// #![feature(trim_direction)]
3809-
///
38103800
/// assert_eq!("11foo1bar11".trim_start_matches('1'), "foo1bar11");
38113801
/// assert_eq!("123foo1bar123".trim_start_matches(char::is_numeric), "foo1bar123");
38123802
///
38133803
/// let x: &[_] = &['1', '2'];
38143804
/// assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12");
38153805
/// ```
3816-
#[unstable(feature = "trim_direction", issue = "30459")]
3806+
#[stable(feature = "trim_direction", since = "1.30.0")]
38173807
pub fn trim_start_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
38183808
let mut i = self.len();
38193809
let mut matcher = pat.into_searcher(self);
@@ -3846,8 +3836,6 @@ impl str {
38463836
/// Simple patterns:
38473837
///
38483838
/// ```
3849-
/// #![feature(trim_direction)]
3850-
///
38513839
/// assert_eq!("11foo1bar11".trim_end_matches('1'), "11foo1bar");
38523840
/// assert_eq!("123foo1bar123".trim_end_matches(char::is_numeric), "123foo1bar");
38533841
///
@@ -3858,11 +3846,9 @@ impl str {
38583846
/// A more complex pattern, using a closure:
38593847
///
38603848
/// ```
3861-
/// #![feature(trim_direction)]
3862-
///
38633849
/// assert_eq!("1fooX".trim_end_matches(|c| c == '1' || c == 'X'), "1foo");
38643850
/// ```
3865-
#[unstable(feature = "trim_direction", issue = "30459")]
3851+
#[stable(feature = "trim_direction", since = "1.30.0")]
38663852
pub fn trim_end_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
38673853
where P::Searcher: ReverseSearcher<'a>
38683854
{

0 commit comments

Comments
 (0)