Skip to content

Commit 0700154

Browse files
committed
Removed IteratorUtil::to_vec and iter::to_vec
1 parent 857d433 commit 0700154

File tree

2 files changed

+11
-52
lines changed

2 files changed

+11
-52
lines changed

src/libstd/iter.rs

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,17 @@ pub trait Times {
5151
fn times(&self, it: &fn() -> bool) -> bool;
5252
}
5353

54+
#[allow(missing_doc)]
5455
pub trait FromIter<T> {
55-
// Build a container with elements from an internal iterator.
56-
//
57-
// # Example:
58-
//
59-
// ~~~ {.rust}
60-
// let xs = ~[1, 2, 3];
61-
// let ys: ~[int] = do FromIter::from_iter |f| { xs.each(|x| f(*x)) };
62-
// assert_eq!(xs, ys);
63-
// ~~~
56+
/// Build a container with elements from an internal iterator.
57+
///
58+
/// # Example:
59+
///
60+
/// ~~~ {.rust}
61+
/// let xs = ~[1, 2, 3];
62+
/// let ys: ~[int] = do FromIter::from_iter |f| { xs.each(|x| f(*x)) };
63+
/// assert_eq!(xs, ys);
64+
/// ~~~
6465
pub fn from_iter(iter: &fn(f: &fn(T) -> bool) -> bool) -> Self;
6566
}
6667

@@ -74,22 +75,6 @@ impl<T> FromIter<T> for ~[T]{
7475
}
7576
}
7677

77-
/**
78-
* Transform an internal iterator into an owned vector.
79-
*
80-
* # Example:
81-
*
82-
* ~~~ {.rust}
83-
* let xs = ~[1, 2, 3];
84-
* let ys = do iter::to_vec |f| { xs.each(|x| f(*x)) };
85-
* assert_eq!(xs, ys);
86-
* ~~~
87-
*/
88-
#[inline(always)]
89-
pub fn to_vec<T>(iter: &fn(f: &fn(T) -> bool) -> bool) -> ~[T] {
90-
FromIter::from_iter(iter)
91-
}
92-
9378
/**
9479
* Return true if `predicate` is true for any values yielded by an internal iterator.
9580
*
@@ -282,16 +267,9 @@ mod tests {
282267
use int;
283268
use uint;
284269

285-
#[test]
286-
fn test_to_vec() {
287-
let xs = ~[1, 2, 3];
288-
let ys = do to_vec |f| { xs.each(|x| f(*x)) };
289-
assert_eq!(xs, ys);
290-
}
291-
292270
#[test]
293271
fn test_from_iter() {
294-
let xs: ~[int] = ~[1, 2, 3];
272+
let xs: = ~[1, 2, 3];
295273
let ys: ~[int] = do FromIter::from_iter |f| { xs.each(|x| f(*x)) };
296274
assert_eq!(xs, ys);
297275
}

src/libstd/iterator.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,6 @@ pub trait IteratorUtil<A> {
242242
/// ~~~
243243
fn advance(&mut self, f: &fn(A) -> bool) -> bool;
244244

245-
/// Loops through the entire iterator, accumulating all of the elements into
246-
/// a vector.
247-
///
248-
/// # Example
249-
///
250-
/// ~~~ {.rust}
251-
/// use std::iterator::*;
252-
///
253-
/// let a = [1, 2, 3, 4, 5];
254-
/// let b = a.iter().transform(|&x| x).to_vec();
255-
/// assert!(a == b);
256-
/// ~~~
257-
fn to_vec(&mut self) -> ~[A];
258-
259245
/// Loops through the entire iterator, collecting all of the elements into
260246
/// a container implementing `FromIter`.
261247
///
@@ -429,11 +415,6 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
429415
}
430416
}
431417

432-
#[inline(always)]
433-
fn to_vec(&mut self) -> ~[A] {
434-
iter::to_vec::<A>(|f| self.advance(f))
435-
}
436-
437418
#[inline(always)]
438419
fn collect<B: FromIter<A>>(&mut self) -> B {
439420
FromIter::from_iter::<A, B>(|f| self.advance(f))

0 commit comments

Comments
 (0)