@@ -521,7 +521,7 @@ pub trait IteratorExt<A>: Iterator<A> {
521
521
/// ```
522
522
#[ inline]
523
523
#[ unstable = "waiting for unboxed closures, just changed to take self by value" ]
524
- fn fold < B > ( mut self , init : B , f : | B , A | -> B ) -> B {
524
+ fn fold < B , F > ( mut self , init : B , mut f : F ) -> B where F : FnMut ( B , A ) -> B {
525
525
let mut accum = init;
526
526
for x in self {
527
527
accum = f ( accum, x) ;
@@ -555,7 +555,7 @@ pub trait IteratorExt<A>: Iterator<A> {
555
555
/// ```
556
556
#[ inline]
557
557
#[ unstable = "waiting for unboxed closures, just changed to take self by value" ]
558
- fn all ( mut self , f: | A | -> bool) -> bool {
558
+ fn all < F > ( mut self , mut f : F ) -> bool where F : FnMut ( A ) -> bool {
559
559
for x in self { if !f ( x) { return false ; } }
560
560
true
561
561
}
@@ -573,7 +573,7 @@ pub trait IteratorExt<A>: Iterator<A> {
573
573
/// ```
574
574
#[ inline]
575
575
#[ unstable = "waiting for unboxed closures" ]
576
- fn any ( & mut self , f: | A | -> bool) -> bool {
576
+ fn any < F > ( & mut self , mut f : F ) -> bool where F : FnMut ( A ) -> bool {
577
577
for x in * self { if f ( x) { return true ; } }
578
578
false
579
579
}
@@ -583,7 +583,7 @@ pub trait IteratorExt<A>: Iterator<A> {
583
583
/// Does not consume the iterator past the first found element.
584
584
#[ inline]
585
585
#[ unstable = "waiting for unboxed closures" ]
586
- fn find ( & mut self , predicate: | & A | -> bool ) -> Option < A > {
586
+ fn find < P > ( & mut self , mut predicate : P ) -> Option < A > where P : FnMut ( & A ) -> bool {
587
587
for x in * self {
588
588
if predicate ( & x) { return Some ( x) }
589
589
}
@@ -593,7 +593,7 @@ pub trait IteratorExt<A>: Iterator<A> {
593
593
/// Return the index of the first element satisfying the specified predicate
594
594
#[ inline]
595
595
#[ unstable = "waiting for unboxed closures" ]
596
- fn position ( & mut self , predicate: | A | -> bool ) -> Option < uint > {
596
+ fn position < P > ( & mut self , mut predicate : P ) -> Option < uint > where P : FnMut ( A ) -> bool {
597
597
let mut i = 0 ;
598
598
for x in * self {
599
599
if predicate ( x) {
@@ -617,7 +617,7 @@ pub trait IteratorExt<A>: Iterator<A> {
617
617
/// ```
618
618
#[ inline]
619
619
#[ unstable = "waiting for unboxed closures, just changed to take self by value" ]
620
- fn max_by < B : Ord > ( self , f: | & A | -> B ) -> Option < A > {
620
+ fn max_by < B : Ord , F > ( self , mut f : F ) -> Option < A > where F : FnMut ( & A ) -> B {
621
621
self . fold ( None , |max : Option < ( A , B ) > , x| {
622
622
let x_val = f ( & x) ;
623
623
match max {
@@ -644,7 +644,7 @@ pub trait IteratorExt<A>: Iterator<A> {
644
644
/// ```
645
645
#[ inline]
646
646
#[ unstable = "waiting for unboxed closures, just changed to take self by value" ]
647
- fn min_by < B : Ord > ( self , f: | & A | -> B ) -> Option < A > {
647
+ fn min_by < B : Ord , F > ( self , mut f : F ) -> Option < A > where F : FnMut ( & A ) -> B {
648
648
self . fold ( None , |min : Option < ( A , B ) > , x| {
649
649
let x_val = f ( & x) ;
650
650
match min {
0 commit comments