@@ -168,7 +168,7 @@ impl<T> [T] {
168
168
core_slice:: SliceExt :: len ( self )
169
169
}
170
170
171
- /// Returns true if the slice has a length of 0
171
+ /// Returns true if the slice has a length of 0.
172
172
///
173
173
/// # Example
174
174
///
@@ -402,7 +402,7 @@ impl<T> [T] {
402
402
core_slice:: SliceExt :: get_unchecked_mut ( self , index)
403
403
}
404
404
405
- /// Returns an raw pointer to the slice's buffer
405
+ /// Returns an raw pointer to the slice's buffer.
406
406
///
407
407
/// The caller must ensure that the slice outlives the pointer this
408
408
/// function returns, or else it will end up pointing to garbage.
@@ -468,7 +468,7 @@ impl<T> [T] {
468
468
///
469
469
/// # Examples
470
470
///
471
- /// ```rust
471
+ /// ```
472
472
/// let mut v = ["a", "b", "c", "d"];
473
473
/// v.swap(1, 3);
474
474
/// assert!(v == ["a", "d", "c", "b"]);
@@ -483,7 +483,7 @@ impl<T> [T] {
483
483
///
484
484
/// # Example
485
485
///
486
- /// ```rust
486
+ /// ```
487
487
/// let mut v = [1, 2, 3];
488
488
/// v.reverse();
489
489
/// assert!(v == [3, 2, 1]);
@@ -567,9 +567,9 @@ impl<T> [T] {
567
567
}
568
568
569
569
/// Returns an iterator over `size` elements of the slice at a
570
- /// time. The chunks are slices and do not overlap. If `size` does not divide the
571
- /// length of the slice, then the last chunk will not have length
572
- /// `size`.
570
+ /// time. The chunks are slices and do not overlap. If `size` does
571
+ /// not divide the length of the slice, then the last chunk will
572
+ /// not have length `size`.
573
573
///
574
574
/// # Panics
575
575
///
@@ -656,7 +656,7 @@ impl<T> [T] {
656
656
///
657
657
/// # Examples
658
658
///
659
- /// ```rust
659
+ /// ```
660
660
/// let mut v = [1, 2, 3, 4, 5, 6];
661
661
///
662
662
/// // scoped to restrict the lifetime of the borrows
@@ -754,7 +754,7 @@ impl<T> [T] {
754
754
}
755
755
756
756
/// Returns an iterator over subslices separated by elements that match
757
- /// `pred`, limited to returning at most `n` items. The matched element is
757
+ /// `pred`, limited to returning at most `n` items. The matched element is
758
758
/// not contained in the subslices.
759
759
///
760
760
/// The last element returned, if any, will contain the remainder of the
@@ -781,7 +781,7 @@ impl<T> [T] {
781
781
}
782
782
783
783
/// Returns an iterator over subslices separated by elements that match
784
- /// `pred`, limited to returning at most `n` items. The matched element is
784
+ /// `pred`, limited to returning at most `n` items. The matched element is
785
785
/// not contained in the subslices.
786
786
///
787
787
/// The last element returned, if any, will contain the remainder of the
@@ -835,7 +835,7 @@ impl<T> [T] {
835
835
836
836
/// Returns an iterator over subslices separated by elements that match
837
837
/// `pred` limited to returning at most `n` items. This starts at the end of
838
- /// the slice and works backwards. The matched element is not contained in
838
+ /// the slice and works backwards. The matched element is not contained in
839
839
/// the subslices.
840
840
///
841
841
/// The last element returned, if any, will contain the remainder of the
@@ -922,9 +922,9 @@ impl<T> [T] {
922
922
///
923
923
/// Looks up a series of four elements. The first is found, with a
924
924
/// uniquely determined position; the second and third are not
925
- /// found; the fourth could match any position in `[1,4]`.
925
+ /// found; the fourth could match any position in `[1, 4]`.
926
926
///
927
- /// ```rust
927
+ /// ```
928
928
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
929
929
///
930
930
/// assert_eq!(s.binary_search(&13), Ok(9));
@@ -956,9 +956,9 @@ impl<T> [T] {
956
956
///
957
957
/// Looks up a series of four elements. The first is found, with a
958
958
/// uniquely determined position; the second and third are not
959
- /// found; the fourth could match any position in `[1,4]`.
959
+ /// found; the fourth could match any position in `[1, 4]`.
960
960
///
961
- /// ```rust
961
+ /// ```
962
962
/// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
963
963
///
964
964
/// let seek = 13;
@@ -982,21 +982,23 @@ impl<T> [T] {
982
982
/// Binary search a sorted slice with a key extraction function.
983
983
///
984
984
/// Assumes that the slice is sorted by the key, for instance with
985
- /// `sort_by_key` using the same key extraction function.
985
+ /// [ `sort_by_key`] using the same key extraction function.
986
986
///
987
987
/// If a matching value is found then returns `Ok`, containing the
988
988
/// index for the matched element; if no match is found then `Err`
989
989
/// is returned, containing the index where a matching element could
990
990
/// be inserted while maintaining sorted order.
991
991
///
992
+ /// [`sort_by_key`]: #method.sort_by_key
993
+ ///
992
994
/// # Examples
993
995
///
994
996
/// Looks up a series of four elements in a slice of pairs sorted by
995
997
/// their second elements. The first is found, with a uniquely
996
998
/// determined position; the second and third are not found; the
997
- /// fourth could match any position in `[1,4]`.
999
+ /// fourth could match any position in `[1, 4]`.
998
1000
///
999
- /// ```rust
1001
+ /// ```
1000
1002
/// let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
1001
1003
/// (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
1002
1004
/// (1, 21), (2, 34), (4, 55)];
@@ -1023,7 +1025,7 @@ impl<T> [T] {
1023
1025
///
1024
1026
/// # Examples
1025
1027
///
1026
- /// ```rust
1028
+ /// ```
1027
1029
/// let mut v = [-5, 4, 1, -3, 2];
1028
1030
///
1029
1031
/// v.sort();
@@ -1045,7 +1047,7 @@ impl<T> [T] {
1045
1047
///
1046
1048
/// # Examples
1047
1049
///
1048
- /// ```rust
1050
+ /// ```
1049
1051
/// let mut v = [-5i32, 4, 1, -3, 2];
1050
1052
///
1051
1053
/// v.sort_by_key(|k| k.abs());
@@ -1067,7 +1069,7 @@ impl<T> [T] {
1067
1069
///
1068
1070
/// # Examples
1069
1071
///
1070
- /// ```rust
1072
+ /// ```
1071
1073
/// let mut v = [5, 4, 1, 3, 2];
1072
1074
/// v.sort_by(|a, b| a.cmp(b));
1073
1075
/// assert!(v == [1, 2, 3, 4, 5]);
@@ -1094,7 +1096,7 @@ impl<T> [T] {
1094
1096
///
1095
1097
/// # Example
1096
1098
///
1097
- /// ```rust
1099
+ /// ```
1098
1100
/// let mut dst = [0, 0, 0];
1099
1101
/// let src = [1, 2, 3];
1100
1102
///
@@ -1116,7 +1118,7 @@ impl<T> [T] {
1116
1118
///
1117
1119
/// # Example
1118
1120
///
1119
- /// ```rust
1121
+ /// ```
1120
1122
/// let mut dst = [0, 0, 0];
1121
1123
/// let src = [1, 2, 3];
1122
1124
///
0 commit comments