From c67a85ada1c949005d030e5cf916aa01c8984f5f Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Thu, 16 May 2013 22:03:58 -0400 Subject: [PATCH] Remove each_permutation_ref --- src/libcore/vec.rs | 60 ---------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 4ad8ff051915..0822fe11f0d0 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1824,26 +1824,6 @@ pub fn each_permutation(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(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 @@ mod tests { 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 @@ mod tests { 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 @@ mod tests { 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 @@ mod tests { 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;