]> git.lizzy.rs Git - rust.git/commitdiff
Adjustments from review
authorAaron Turon <aturon@mozilla.com>
Mon, 29 Dec 2014 23:57:31 +0000 (15:57 -0800)
committerAaron Turon <aturon@mozilla.com>
Tue, 30 Dec 2014 20:02:22 +0000 (12:02 -0800)
src/libcollections/slice.rs
src/libcollections/vec.rs
src/libcore/iter.rs

index 5bc99889f2ffe4a88fb49c0c431555d227d11daa..375ba38f29aabd7e8b3a063f61b572b07bfb99a2 100644 (file)
@@ -831,7 +831,7 @@ pub trait CloneSliceExt<T> for Sized? {
     /// assert_eq!(Some(vec![1i, 3, 2]), perms.next());
     /// assert_eq!(Some(vec![3i, 1, 2]), perms.next());
     /// ```
-    #[stable]
+    #[unstable]
     fn permutations(&self) -> Permutations<T>;
 
     /// Copies as many elements from `src` as it can into `self` (the
@@ -950,7 +950,7 @@ fn binary_search_elem(&self, x: &T) -> Result<uint, uint> {
     /// let b: &mut [_] = &mut [1i, 0, 2];
     /// assert!(v == b);
     /// ```
-    #[stable]
+    #[unstable = "uncertain if this merits inclusion in std"]
     fn next_permutation(&mut self) -> bool;
 
     /// Mutates the slice to the previous lexicographic permutation.
@@ -969,7 +969,7 @@ fn binary_search_elem(&self, x: &T) -> Result<uint, uint> {
     /// let b: &mut [_] = &mut [0i, 1, 2];
     /// assert!(v == b);
     /// ```
-    #[stable]
+    #[unstable = "uncertain if this merits inclusion in std"]
     fn prev_permutation(&mut self) -> bool;
 }
 
@@ -1165,7 +1165,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 /// swap applied.
 ///
 /// Generates even and odd permutations alternately.
-#[stable]
+#[unstable]
 pub struct Permutations<T> {
     swaps: ElementSwaps,
     v: Vec<T>,
index 3e0b3b4aa74ae9f6c4fc0ae458e51b100dbce9dd..2d71705d80d387b0261d0c579fdff1a4505b75f2 100644 (file)
@@ -261,7 +261,7 @@ pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
     /// owned by the returned `Vec<T>`. The elements of the buffer are copied into the vector
     /// without cloning, as if `ptr::read()` were called on them.
     #[inline]
-    #[stable]
+    #[unstable = "may be better expressed via composition"]
     pub unsafe fn from_raw_buf(ptr: *const T, elts: uint) -> Vec<T> {
         let mut dst = Vec::with_capacity(elts);
         dst.set_len(elts);
index 028d2ce1cbbb793c796bd2c58e8a185ed3a83c84..a185ec56a00e7e9750960c3238f3b2e172235fa6 100644 (file)
@@ -691,13 +691,14 @@ fn min_by<B: Ord, F>(self, mut f: F) -> Option<A> where F: FnMut(&A) -> B {
 impl<A, I> IteratorExt<A> for I where I: Iterator<A> {}
 
 /// Extention trait for iterators of pairs.
+#[unstable = "newly added trait, likely to be merged with IteratorExt"]
 pub trait IteratorPairExt<A, B>: Iterator<(A, B)> {
     /// Converts an iterator of pairs into a pair of containers.
     ///
     /// Loops through the entire iterator, collecting the first component of
     /// each item into one new container, and the second component into another.
     fn unzip<FromA, FromB>(mut self) -> (FromA, FromB) where
-        FromA: FromIterator<A> + Extend<A>, FromB: FromIterator<B> + Extend<B>
+        FromA: Default + Extend<A>, FromB: Default + Extend<B>
     {
         struct SizeHint<A>(uint, Option<uint>);
         impl<A> Iterator<A> for SizeHint<A> {
@@ -708,8 +709,11 @@ fn size_hint(&self) -> (uint, Option<uint>) {
         }
 
         let (lo, hi) = self.size_hint();
-        let mut ts: FromA = FromIterator::from_iter(SizeHint(lo, hi));
-        let mut us: FromB = FromIterator::from_iter(SizeHint(lo, hi));
+        let mut ts: FromA = Default::default();
+        let mut us: FromB = Default::default();
+
+        ts.extend(SizeHint(lo, hi));
+        us.extend(SizeHint(lo, hi));
 
         for (t, u) in self {
             ts.extend(Some(t).into_iter());