diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-06-12 23:09:56 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-06-14 23:15:42 -0400 |
| commit | 824a6277af9e614767e0570ecc282065256ac32a (patch) | |
| tree | cfe7b81d1b6d2a17b609a2397dea2b43d6077518 /src/libstd | |
| parent | d68be89e6912a394beb12c2731bdc6240a81655b (diff) | |
| download | rust-824a6277af9e614767e0570ecc282065256ac32a.tar.gz rust-824a6277af9e614767e0570ecc282065256ac32a.zip | |
rm CopyableNonstrictIter
copies can just be done explicitly: `xs.transform(|x|x.clone())`
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/old_iter.rs | 7 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 2 | ||||
| -rw-r--r-- | src/libstd/vec.rs | 45 |
3 files changed, 1 insertions, 53 deletions
diff --git a/src/libstd/old_iter.rs b/src/libstd/old_iter.rs index e0a01a41f0a..9fea4376816 100644 --- a/src/libstd/old_iter.rs +++ b/src/libstd/old_iter.rs @@ -59,13 +59,6 @@ pub trait CopyableOrderedIter<A:Copy + Ord> { fn max(&self) -> A; } -pub trait CopyableNonstrictIter<A:Copy> { - // Like "each", but copies out the value. If the receiver is mutated while - // iterating over it, the semantics must not be memory-unsafe but are - // otherwise undefined. - fn each_val(&const self, f: &fn(A) -> bool) -> bool; -} - // A trait for sequences that can be built by imperatively pushing elements // onto them. pub trait Buildable<A> { diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index c61995619a4..61b8d36266e 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -47,7 +47,7 @@ pub use char::Char; pub use container::{Container, Mutable, Map, Set}; pub use hash::Hash; pub use old_iter::{BaseIter, ReverseIter, ExtendedIter, EqIter}; -pub use old_iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter}; +pub use old_iter::{CopyableIter, CopyableOrderedIter}; pub use iter::{Times, FromIter}; pub use iterator::{Iterator, IteratorUtil}; pub use num::{Num, NumCast}; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index b5ae605e03c..91e94f7dcf8 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -2630,41 +2630,6 @@ impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for @[A] { fn max(&self) -> A { old_iter::max(self) } } -impl<'self,A:Copy> old_iter::CopyableNonstrictIter<A> for &'self [A] { - fn each_val(&const self, f: &fn(A) -> bool) -> bool { - let mut i = 0; - while i < self.len() { - if !f(copy self[i]) { return false; } - i += 1; - } - return true; - } -} - -// FIXME(#4148): This should be redundant -impl<A:Copy> old_iter::CopyableNonstrictIter<A> for ~[A] { - fn each_val(&const self, f: &fn(A) -> bool) -> bool { - let mut i = 0; - while i < uniq_len(self) { - if !f(copy self[i]) { return false; } - i += 1; - } - return true; - } -} - -// FIXME(#4148): This should be redundant -impl<A:Copy> old_iter::CopyableNonstrictIter<A> for @[A] { - fn each_val(&const self, f: &fn(A) -> bool) -> bool { - let mut i = 0; - while i < self.len() { - if !f(copy self[i]) { return false; } - i += 1; - } - return true; - } -} - impl<A:Clone> Clone for ~[A] { #[inline] fn clone(&self) -> ~[A] { @@ -4326,14 +4291,4 @@ 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_each_val() { - use old_iter::CopyableNonstrictIter; - let mut i = 0; - for [1, 2, 3].each_val |v| { - i += v; - } - assert_eq!(i, 6); - } } |
