]> git.lizzy.rs Git - rust.git/commitdiff
Remove each_permutation_ref
authorCorey Richardson <corey@octayn.net>
Fri, 17 May 2013 02:03:58 +0000 (22:03 -0400)
committerCorey Richardson <corey@octayn.net>
Fri, 17 May 2013 02:05:05 +0000 (22:05 -0400)
src/libcore/vec.rs

index 4ad8ff05191526b17fd228ae2f2f8a1b99b57b87..0822fe11f0d07c1c8f931c866fb8183db9d6c3b8 100644 (file)
@@ -1824,26 +1824,6 @@ pub fn each_permutation<T:Copy>(values: &[T], fun: &fn(perm : &[T]) -> bool) {
     }
 }
 
-/**
- * Iterate over all permutations of vector `values`.
- *
- * This is an alternative to each_permutation that uses references to
- * avoid copying the elements of the values vector.
- *
- * To avoid copying, the iterator will be passed a reference to a vector
- * containing references to the elements in the original `values` vector.
- *
- * # Arguments
- *
- * * `values` - A vector of values from which the permutations are chosen
- *
- * * `fun` - The function to iterate over the permutations
- */
-#[cfg(not(stage0))]
-pub fn each_permutation_ref<T>(values : &[T], fun : &fn(perm : &[&T]) -> bool) {
-    each_permutation(vec::from_fn(values.len(), |i| &values[i]), fun);
-}
-
 /**
  * Iterate over all contiguous windows of length `n` of the vector `v`.
  *
@@ -4827,16 +4807,6 @@ fn test_permutations0() {
         assert_eq!(v, ~[~[]]);
     }
 
-    #[test]
-    fn test_permutations0_ref() {
-        let values = [];
-        let mut v : ~[~[int]] = ~[];
-        for each_permutation_ref(values) |p| {
-            v.push(p.to_owned());
-        }
-        assert_eq!(v, ~[~[]]);
-    }
-
     #[test]
     fn test_permutations1() {
         let values = [1];
@@ -4847,16 +4817,6 @@ fn test_permutations1() {
         assert_eq!(v, ~[~[1]]);
     }
 
-    #[test]
-    fn test_permutations1_ref() {
-        let values = [1];
-        let mut v : ~[~[int]] = ~[];
-        for each_permutation_ref(values) |p| {
-            v.push(p.to_owned());
-        }
-        assert_eq!(v, ~[~[1]]);
-    }
-
     #[test]
     fn test_permutations2() {
         let values = [1,2];
@@ -4867,16 +4827,6 @@ fn test_permutations2() {
         assert_eq!(v, ~[~[1,2],~[2,1]]);
     }
 
-    #[test]
-    fn test_permutations2_ref() {
-        let values = [1,2];
-        let mut v : ~[~[int]] = ~[];
-        for each_permutation_ref(values) |p| {
-            v.push(p.to_owned());
-        }
-        assert_eq!(v, ~[~[1,2],~[2,1]]);
-    }
-
     #[test]
     fn test_permutations3() {
         let values = [1,2,3];
@@ -4887,16 +4837,6 @@ fn test_permutations3() {
         assert_eq!(v, ~[~[1,2,3],~[1,3,2],~[2,1,3],~[2,3,1],~[3,1,2],~[3,2,1]]);
     }
 
-    #[test]
-    fn test_permutations3_ref() {
-        let values = [1,2,3];
-        let mut v : ~[~[int]] = ~[];
-        for each_permutation_ref(values) |p| {
-            v.push(p.to_owned());
-        }
-        assert_eq!(v, ~[~[1,2,3],~[1,3,2],~[2,1,3],~[2,3,1],~[3,1,2],~[3,2,1]]);
-    }
-
     #[test]
     fn test_each_val() {
         use old_iter::CopyableNonstrictIter;