@@ -1342,14 +1342,12 @@ impl<T> [T] {
13421342 /// slice. Equivalently, rotates the slice `mid` places to the left
13431343 /// or `k = self.len() - mid` places to the right.
13441344 ///
1345- /// Rotation by `mid` and rotation by `k` are inverse operations.
1346- /// The method returns `k`, which is also the new location of
1347- /// the formerly-first element.
1348- ///
13491345 /// This is a "k-rotation", a permutation in which item `i` moves to
13501346 /// position `i + k`, modulo the length of the slice. See _Elements
13511347 /// of Programming_ [§10.4][eop].
13521348 ///
1349+ /// Rotation by `mid` and rotation by `k` are inverse operations.
1350+ ///
13531351 /// [eop]: https://books.google.com/books?id=CO9ULZGINlsC&pg=PA178&q=k-rotation
13541352 ///
13551353 /// # Panics
@@ -1368,8 +1366,10 @@ impl<T> [T] {
13681366 /// #![feature(slice_rotate)]
13691367 ///
13701368 /// let mut a = [1, 2, 3, 4, 5, 6, 7];
1371- /// let k = a.rotate(2);
1369+ /// let mid = 2;
1370+ /// a.rotate(mid);
13721371 /// assert_eq!(&a, &[3, 4, 5, 6, 7, 1, 2]);
1372+ /// let k = a.len() - mid;
13731373 /// a.rotate(k);
13741374 /// assert_eq!(&a, &[1, 2, 3, 4, 5, 6, 7]);
13751375 ///
@@ -1388,8 +1388,8 @@ impl<T> [T] {
13881388 /// assert_eq!(&v, &[0, 3, 7, 4, 5, 6, 1, 2, 8, 9]);
13891389 /// ```
13901390 #[ unstable( feature = "slice_rotate" , issue = "41891" ) ]
1391- pub fn rotate ( & mut self , mid : usize ) -> usize {
1392- core_slice:: SliceExt :: rotate ( self , mid)
1391+ pub fn rotate ( & mut self , mid : usize ) {
1392+ core_slice:: SliceExt :: rotate ( self , mid) ;
13931393 }
13941394
13951395 /// Copies the elements from `src` into `self`.
0 commit comments