File tree 2 files changed +1
-30
lines changed 2 files changed +1
-30
lines changed Original file line number Diff line number Diff line change @@ -77,16 +77,6 @@ impl<T> Deque<T> {
77
77
get ( self . elts , idx)
78
78
}
79
79
80
- /// Iterate over the elements in the deque
81
- pub fn each ( & self , f : & fn ( & T ) -> bool ) -> bool {
82
- self . eachi ( |_i, e| f ( e) )
83
- }
84
-
85
- /// Iterate over the elements in the deque by index
86
- pub fn eachi ( & self , f : & fn ( uint , & T ) -> bool ) -> bool {
87
- uint:: range ( 0 , self . nelts , |i| f ( i, self . get ( i as int ) ) )
88
- }
89
-
90
80
/// Remove and return the first element in the deque
91
81
///
92
82
/// Fails if the deque is empty
@@ -514,25 +504,6 @@ mod tests {
514
504
test_parameterized :: < RecCy > ( reccy1, reccy2, reccy3, reccy4) ;
515
505
}
516
506
517
- #[ test]
518
- fn test_eachi ( ) {
519
- let mut deq = Deque :: new ( ) ;
520
- deq. add_back ( 1 ) ;
521
- deq. add_back ( 2 ) ;
522
- deq. add_back ( 3 ) ;
523
-
524
- for deq. eachi |i, e| {
525
- assert_eq ! ( * e, i + 1 ) ;
526
- }
527
-
528
- deq. pop_front ( ) ;
529
-
530
- for deq. eachi |i, e| {
531
- assert_eq ! ( * e, i + 2 ) ;
532
- }
533
-
534
- }
535
-
536
507
#[ test]
537
508
fn test_with_capacity ( ) {
538
509
let mut d = Deque :: with_capacity ( 0 ) ;
Original file line number Diff line number Diff line change @@ -682,7 +682,7 @@ impl<
682
682
> Encodable < S > for Deque < T > {
683
683
fn encode ( & self , s : & mut S ) {
684
684
do s. emit_seq ( self . len ( ) ) |s| {
685
- for self . eachi | i, e| {
685
+ for self . iter ( ) . enumerate ( ) . advance | ( i, e) | {
686
686
s. emit_seq_elt ( i, |s| e. encode ( s) ) ;
687
687
}
688
688
}
You can’t perform that action at this time.
0 commit comments