diff options
| author | varkor <github@varkor.com> | 2018-08-05 21:51:40 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-08-05 22:48:30 +0100 |
| commit | 3e10ffcb81e8f887289904e5aaf272e872a9cb2c (patch) | |
| tree | ed12979c4981b0403d25a161ed0e66afc4616a72 | |
| parent | 33067ad2011ce97e80a247c5a1a9bdb15fc4f376 (diff) | |
| download | rust-3e10ffcb81e8f887289904e5aaf272e872a9cb2c.tar.gz rust-3e10ffcb81e8f887289904e5aaf272e872a9cb2c.zip | |
Make features stable and clarify examples
| -rw-r--r-- | src/liballoc/tests/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 30 |
2 files changed, 8 insertions, 23 deletions
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 0dcbcf50fb4..618aff963f2 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -25,7 +25,6 @@ #![feature(unboxed_closures)] #![feature(exact_chunks)] #![feature(repeat_generic_slice)] -#![feature(trim_direction)] extern crate alloc_system; extern crate core; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 00e296be4f2..0caab089a3b 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -3604,8 +3604,6 @@ impl str { /// Basic usage: /// /// ``` - /// #![feature(trim_direction)] - /// /// let s = " Hello\tworld\t"; /// assert_eq!("Hello\tworld\t", s.trim_start()); /// ``` @@ -3613,15 +3611,13 @@ impl str { /// Directionality: /// /// ``` - /// #![feature(trim_direction)] - /// - /// let s = " English"; + /// let s = " English "; /// assert!(Some('E') == s.trim_start().chars().next()); /// - /// let s = " עברית"; + /// let s = " עברית "; /// assert!(Some('ע') == s.trim_start().chars().next()); /// ``` - #[unstable(feature = "trim_direction", issue = "30459")] + #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_start(&self) -> &str { self.trim_start_matches(|c: char| c.is_whitespace()) } @@ -3643,8 +3639,6 @@ impl str { /// Basic usage: /// /// ``` - /// #![feature(trim_direction)] - /// /// let s = " Hello\tworld\t"; /// assert_eq!(" Hello\tworld", s.trim_end()); /// ``` @@ -3652,15 +3646,13 @@ impl str { /// Directionality: /// /// ``` - /// #![feature(trim_direction)] - /// - /// let s = "English "; + /// let s = " English "; /// assert!(Some('h') == s.trim_end().chars().rev().next()); /// - /// let s = "עברית "; + /// let s = " עברית "; /// assert!(Some('ת') == s.trim_end().chars().rev().next()); /// ``` - #[unstable(feature = "trim_direction", issue = "30459")] + #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_end(&self) -> &str { self.trim_end_matches(|c: char| c.is_whitespace()) } @@ -3805,15 +3797,13 @@ impl str { /// Basic usage: /// /// ``` - /// #![feature(trim_direction)] - /// /// assert_eq!("11foo1bar11".trim_start_matches('1'), "foo1bar11"); /// assert_eq!("123foo1bar123".trim_start_matches(char::is_numeric), "foo1bar123"); /// /// let x: &[_] = &['1', '2']; /// assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12"); /// ``` - #[unstable(feature = "trim_direction", issue = "30459")] + #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_start_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str { let mut i = self.len(); let mut matcher = pat.into_searcher(self); @@ -3846,8 +3836,6 @@ impl str { /// Simple patterns: /// /// ``` - /// #![feature(trim_direction)] - /// /// assert_eq!("11foo1bar11".trim_end_matches('1'), "11foo1bar"); /// assert_eq!("123foo1bar123".trim_end_matches(char::is_numeric), "123foo1bar"); /// @@ -3858,11 +3846,9 @@ impl str { /// A more complex pattern, using a closure: /// /// ``` - /// #![feature(trim_direction)] - /// /// assert_eq!("1fooX".trim_end_matches(|c| c == '1' || c == 'X'), "1foo"); /// ``` - #[unstable(feature = "trim_direction", issue = "30459")] + #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_end_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: ReverseSearcher<'a> { |
