Skip to content

Commit 824a627

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

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
@@ -2630,41 +2630,6 @@ impl<A:Copy + Ord> old_iter::CopyableOrderedIter<A> for @[A] {
26302630
fn max(&self) -> A { old_iter::max(self) }
26312631
}
26322632

2633-
impl<'self,A:Copy> old_iter::CopyableNonstrictIter<A> for &'self [A] {
2634-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2635-
let mut i = 0;
2636-
while i < self.len() {
2637-
if !f(copy self[i]) { return false; }
2638-
i += 1;
2639-
}
2640-
return true;
2641-
}
2642-
}
2643-
2644-
// FIXME(#4148): This should be redundant
2645-
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for ~[A] {
2646-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2647-
let mut i = 0;
2648-
while i < uniq_len(self) {
2649-
if !f(copy self[i]) { return false; }
2650-
i += 1;
2651-
}
2652-
return true;
2653-
}
2654-
}
2655-
2656-
// FIXME(#4148): This should be redundant
2657-
impl<A:Copy> old_iter::CopyableNonstrictIter<A> for @[A] {
2658-
fn each_val(&const self, f: &fn(A) -> bool) -> bool {
2659-
let mut i = 0;
2660-
while i < self.len() {
2661-
if !f(copy self[i]) { return false; }
2662-
i += 1;
2663-
}
2664-
return true;
2665-
}
2666-
}
2667-
26682633
impl<A:Clone> Clone for ~[A] {
26692634
#[inline]
26702635
fn clone(&self) -> ~[A] {
@@ -4326,14 +4291,4 @@ mod tests {
43264291
}
43274292
assert_eq!(v, ~[~[1,2,3],~[1,3,2],~[2,1,3],~[2,3,1],~[3,1,2],~[3,2,1]]);
43284293
}
4329-
4330-
#[test]
4331-
fn test_each_val() {
4332-
use old_iter::CopyableNonstrictIter;
4333-
let mut i = 0;
4334-
for [1, 2, 3].each_val |v| {
4335-
i += v;
4336-
}
4337-
assert_eq!(i, 6);
4338-
}
43394294
}

0 commit comments

Comments
 (0)