aboutsummaryrefslogtreecommitdiff
path: root/libcollections/slice.rs
diff options
context:
space:
mode:
authorpravic <[email protected]>2016-06-06 23:07:53 +0300
committerpravic <[email protected]>2016-06-06 23:07:53 +0300
commitf2db0929feeb53567655dbdebba7e6b1c3f2f69e (patch)
treec2cf041f838782f9ddd8994146f52e8f498bfe07 /libcollections/slice.rs
parentadd 'netio' native import library (diff)
parentMerge branch 'nofp_patch' into libcore_nofp (diff)
downloadkmd-env-rs-master.tar.xz
kmd-env-rs-master.zip
Merge branch 'libcore_nofp'HEADmaster
Diffstat (limited to 'libcollections/slice.rs')
-rw-r--r--libcollections/slice.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/libcollections/slice.rs b/libcollections/slice.rs
index 588ad7a..cef8a33 100644
--- a/libcollections/slice.rs
+++ b/libcollections/slice.rs
@@ -419,8 +419,8 @@ impl<T> [T] {
///
/// ```rust
/// let v = &[1, 2, 3, 4, 5];
- /// for win in v.chunks(2) {
- /// println!("{:?}", win);
+ /// for chunk in v.chunks(2) {
+ /// println!("{:?}", chunk);
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
@@ -759,7 +759,6 @@ impl<T> [T] {
/// fourth could match any position in `[1,4]`.
///
/// ```rust
- /// #![feature(slice_binary_search_by_key)]
/// let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
/// (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
/// (1, 21), (2, 34), (4, 55)];
@@ -770,7 +769,7 @@ impl<T> [T] {
/// let r = s.binary_search_by_key(&1, |&(a,b)| b);
/// assert!(match r { Ok(1...4) => true, _ => false, });
/// ```
- #[unstable(feature = "slice_binary_search_by_key", reason = "recently added", issue = "33018")]
+ #[stable(feature = "slice_binary_search_by_key", since = "1.10.0")]
#[inline]
pub fn binary_search_by_key<B, F>(&self, b: &B, f: F) -> Result<usize, usize>
where F: FnMut(&T) -> B,
@@ -779,11 +778,10 @@ impl<T> [T] {
core_slice::SliceExt::binary_search_by_key(self, b, f)
}
- /// Sorts the slice, in place.
- ///
/// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
///
- /// This is a stable sort.
+ /// This sort is stable and `O(n log n)` worst-case but allocates
+ /// approximately `2 * n` where `n` is the length of `self`.
///
/// # Examples
///
@@ -804,11 +802,9 @@ impl<T> [T] {
/// Sorts the slice, in place, using `key` to extract a key by which to
/// order the sort by.
///
- /// This sort is `O(n log n)` worst-case and stable, but allocates
+ /// This sort is stable and `O(n log n)` worst-case but allocates
/// approximately `2 * n`, where `n` is the length of `self`.
///
- /// This is a stable sort.
- ///
/// # Examples
///
/// ```rust
@@ -828,7 +824,7 @@ impl<T> [T] {
/// Sorts the slice, in place, using `compare` to compare
/// elements.
///
- /// This sort is `O(n log n)` worst-case and stable, but allocates
+ /// This sort is stable and `O(n log n)` worst-case but allocates
/// approximately `2 * n`, where `n` is the length of `self`.
///
/// # Examples