diff options
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/slice.rs | 2 | ||||
| -rw-r--r-- | src/libcollections/str.rs | 6 | ||||
| -rw-r--r-- | src/libcollections/string.rs | 2 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/vec_deque.rs | 3 |
5 files changed, 8 insertions, 9 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 050997f2dd3..929c97dceb2 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -557,7 +557,6 @@ impl<T> [T] { /// ```rust /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; - /// let s = s.as_slice(); /// /// let seek = 13; /// assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9)); @@ -924,7 +923,6 @@ impl<T> [T] { /// ```rust /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; - /// let s = s.as_slice(); /// /// assert_eq!(s.binary_search(&13), Ok(9)); /// assert_eq!(s.binary_search(&4), Err(7)); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 9ddf8988f1e..f517ce7d535 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1470,12 +1470,12 @@ impl str { /// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>(); /// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"]; /// - /// assert_eq!(gr1.as_slice(), b); + /// assert_eq!(&gr1[..], b); /// /// let gr2 = "a\r\nb🇷🇺🇸🇹".graphemes(true).collect::<Vec<&str>>(); /// let b: &[_] = &["a", "\r\n", "b", "🇷🇺🇸🇹"]; /// - /// assert_eq!(gr2.as_slice(), b); + /// assert_eq!(&gr2[..], b); /// ``` #[unstable(feature = "unicode", reason = "this functionality may only be provided by libunicode")] @@ -1493,7 +1493,7 @@ impl str { /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>(); /// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")]; /// - /// assert_eq!(gr_inds.as_slice(), b); + /// assert_eq!(&gr_inds[..], b); /// ``` #[unstable(feature = "unicode", reason = "this functionality may only be provided by libunicode")] diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index dbf214a712b..2adece30307 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -93,7 +93,7 @@ impl String { /// ``` /// # #![feature(collections, core)] /// let s = String::from_str("hello"); - /// assert_eq!(s.as_slice(), "hello"); + /// assert_eq!(&s[..], "hello"); /// ``` #[inline] #[unstable(feature = "collections", diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3595288a6c9..242efbcd45b 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -823,13 +823,13 @@ impl<T> Vec<T> { /// # #![feature(collections, core)] /// let v = vec![0, 1, 2]; /// let w = v.map_in_place(|i| i + 3); - /// assert_eq!(w.as_slice(), [3, 4, 5].as_slice()); + /// assert_eq!(&w[..], &[3, 4, 5]); /// /// #[derive(PartialEq, Debug)] /// struct Newtype(u8); /// let bytes = vec![0x11, 0x22]; /// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x)); - /// assert_eq!(newtyped_bytes.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice()); + /// assert_eq!(&newtyped_bytes[..], &[Newtype(0x11), Newtype(0x22)]); /// ``` #[unstable(feature = "collections", reason = "API may change to provide stronger guarantees")] diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 392e5092e3b..6083f03477c 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -527,7 +527,8 @@ impl<T> VecDeque<T> { /// buf.push_back(3); /// buf.push_back(4); /// let b: &[_] = &[&5, &3, &4]; - /// assert_eq!(buf.iter().collect::<Vec<&i32>>().as_slice(), b); + /// let c: Vec<&i32> = buf.iter().collect(); + /// assert_eq!(&c[..], b); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<T> { |
