Skip to content

Commit b252c33

Browse files
committed
rm CopyableNonstrictIter
copies can just be done explicitly: `xs.transform(|x|x.clone())`
1 parent d168f91 commit b252c33

File tree

3 files changed

+1
-53
lines changed

3 files changed

+1
-53
lines changed

src/libstd/old_iter.rs

-7
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ pub trait CopyableOrderedIter<A:Copy + Ord> {
5959
fn max(&self) -> A;
6060
}
6161

62-
pub trait CopyableNonstrictIter<A:Copy> {
63-
// Like "each", but copies out the value. If the receiver is mutated while
64-
// iterating over it, the semantics must not be memory-unsafe but are
65-
// otherwise undefined.
66-
fn each_val(&const self, f: &fn(A) -> bool) -> bool;
67-
}
68-
6962
// A trait for sequences that can be built by imperatively pushing elements
7063
// onto them.
7164
pub trait Buildable<A> {

src/libstd/prelude.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub use char::Char;
4747
pub use container::{Container, Mutable, Map, Set};
4848
pub use hash::Hash;
4949
pub use old_iter::{BaseIter, ReverseIter, ExtendedIter, EqIter};
50-
pub use old_iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
50+
pub use old_iter::{CopyableIter, CopyableOrderedIter};
5151
pub use iter::{Times, FromIter};
5252
pub use iterator::{Iterator, IteratorUtil};
5353
pub use num::{Num, NumCast};

src/libstd/vec.rs

-45
Original file line numberDiff line numberDiff line change
@@ -2624,41 +2624,6 @@ impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for @[A] {
26242624
fn max(&self) -> A { old_iter::max(self) }
26252625
}
26262626

2627-
impl<'self,A:Copy> old_iter::CopyableNonstrictIter<A> for &'self [A] {
2628-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2629-
let mut i = 0;
2630-
while i < self.len() {
2631-
if !f(copy self[i]) { return false; }
2632-
i += 1;
2633-
}
2634-
return true;
2635-
}
2636-
}
2637-
2638-
// FIXME(#4148): This should be redundant
2639-
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for ~[A] {
2640-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2641-
let mut i = 0;
2642-
while i < uniq_len(self) {
2643-
if !f(copy self[i]) { return false; }
2644-
i += 1;
2645-
}
2646-
return true;
2647-
}
2648-
}
2649-
2650-
// FIXME(#4148): This should be redundant
2651-
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for @[A] {
2652-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2653-
let mut i = 0;
2654-
while i < self.len() {
2655-
if !f(copy self[i]) { return false; }
2656-
i += 1;
2657-
}
2658-
return true;
2659-
}
2660-
}
2661-
26622627
impl<A:Clone> Clone for ~[A] {
26632628
#[inline]
26642629
fn clone(&self) -> ~[A] {
@@ -4320,14 +4285,4 @@ mod tests {
43204285
}
43214286
assert_eq!(v, ~[~[1,2,3],~[1,3,2],~[2,1,3],~[2,3,1],~[3,1,2],~[3,2,1]]);
43224287
}
4323-
4324-
#[test]
4325-
fn test_each_val() {
4326-
use old_iter::CopyableNonstrictIter;
4327-
let mut i = 0;
4328-
for [1, 2, 3].each_val |v| {
4329-
i += v;
4330-
}
4331-
assert_eq!(i, 6);
4332-
}
43334288
}

0 commit comments

Comments
 (0)