@@ -49,7 +49,6 @@ pub trait IteratorUtil<A> {
49
49
fn advance ( & mut self , f : & fn ( A ) -> bool ) -> bool ;
50
50
fn to_vec ( self ) -> ~[ A ] ;
51
51
fn nth ( & mut self , n : uint ) -> A ;
52
- fn first ( & mut self ) -> A ;
53
52
fn last ( & mut self ) -> A ;
54
53
fn fold < B > ( & mut self , start : B , f : & fn ( B , A ) -> B ) -> B ;
55
54
fn count ( & mut self ) -> uint ;
@@ -168,15 +167,6 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
168
167
}
169
168
}
170
169
171
- // Get first elemet of an iterator.
172
- #[ inline( always) ]
173
- fn first ( & mut self ) -> A {
174
- match self . next ( ) {
175
- Some ( x) => x ,
176
- None => fail ! ( "cannot get first element" )
177
- }
178
- }
179
-
180
170
// Get last element of an iterator.
181
171
//
182
172
// If the iterator have an infinite length, this method won't return.
@@ -700,20 +690,6 @@ mod tests {
700
690
v. iter ( ) . nth ( 5 ) ;
701
691
}
702
692
703
- #[ test]
704
- fn test_iterator_first ( ) {
705
- let v = & [ 0 , 1 , 2 , 3 , 4 ] ;
706
- assert_eq ! ( v. iter( ) . first( ) , & 0 ) ;
707
- assert_eq ! ( v. slice( 2 , 5 ) . iter( ) . first( ) , & 2 ) ;
708
- }
709
-
710
- #[ test]
711
- #[ should_fail]
712
- fn test_iterator_first_fail ( ) {
713
- let v: & [ uint ] = & [ ] ;
714
- v. iter ( ) . first ( ) ;
715
- }
716
-
717
693
#[ test]
718
694
fn test_iterator_last ( ) {
719
695
let v = & [ 0 , 1 , 2 , 3 , 4 ] ;
0 commit comments