@@ -51,16 +51,17 @@ pub trait Times {
51
51
fn times ( & self , it : & fn ( ) -> bool ) -> bool ;
52
52
}
53
53
54
+ #[ allow( missing_doc) ]
54
55
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
+ /// ~~~
64
65
pub fn from_iter ( iter : & fn ( f : & fn ( T ) -> bool ) -> bool ) -> Self ;
65
66
}
66
67
@@ -74,22 +75,6 @@ impl<T> FromIter<T> for ~[T]{
74
75
}
75
76
}
76
77
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
-
93
78
/**
94
79
* Return true if `predicate` is true for any values yielded by an internal iterator.
95
80
*
@@ -282,16 +267,9 @@ mod tests {
282
267
use int;
283
268
use uint;
284
269
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
-
292
270
#[ test]
293
271
fn test_from_iter ( ) {
294
- let xs: ~ [ int ] = ~[ 1 , 2 , 3 ] ;
272
+ let xs: = ~[ 1 , 2 , 3 ] ;
295
273
let ys: ~[ int ] = do FromIter :: from_iter |f| { xs. each ( |x| f ( * x) ) } ;
296
274
assert_eq ! ( xs, ys) ;
297
275
}
0 commit comments