@@ -230,7 +230,7 @@ Returns:
230
230
An option containing the last element of `v` if `v` is not empty, or
231
231
none if `v` is empty.
232
232
*/
233
- pure fn last < T : copy > ( v : [ const T ] ) -> option:: t < T > {
233
+ pure fn last < T : copy > ( v : [ const T ] ) -> option < T > {
234
234
if len ( v) == 0 u { ret none; }
235
235
ret some( v[ len ( v) - 1 u] ) ;
236
236
}
@@ -445,7 +445,7 @@ Apply a function to each element of a vector and return the results
445
445
If function `f` returns `none` then that element is excluded from
446
446
the resulting vector.
447
447
*/
448
- fn filter_map < T : copy , U : copy > ( v : [ const T ] , f : fn ( T ) -> option:: t < U > )
448
+ fn filter_map < T : copy , U : copy > ( v : [ const T ] , f : fn ( T ) -> option < U > )
449
449
-> [ U ] {
450
450
let result = [ ] ;
451
451
for elem: T in v {
@@ -599,7 +599,7 @@ Apply function `f` to each element of `v`, starting from the first.
599
599
When function `f` returns true then an option containing the element
600
600
is returned. If `f` matches no elements then none is returned.
601
601
*/
602
- fn find < T : copy > ( v : [ T ] , f : fn ( T ) -> bool ) -> option:: t < T > {
602
+ fn find < T : copy > ( v : [ T ] , f : fn ( T ) -> bool ) -> option < T > {
603
603
for elt: T in v { if f ( elt) { ret some ( elt) ; } }
604
604
ret none;
605
605
}
@@ -614,7 +614,7 @@ Returns:
614
614
option::some(uint) - The first index containing a matching value
615
615
option::none - No elements matched
616
616
*/
617
- fn position < T > ( x : T , v : [ T ] ) -> option:: t < uint > {
617
+ fn position < T > ( x : T , v : [ T ] ) -> option < uint > {
618
618
let i: uint = 0 u;
619
619
while i < len ( v) { if x == v[ i] { ret some :: < uint > ( i) ; } i += 1 u; }
620
620
ret none;
@@ -625,7 +625,7 @@ Function: position_pred
625
625
626
626
Find the first index for which the value matches some predicate
627
627
*/
628
- fn position_pred < T > ( v : [ T ] , f : fn ( T ) -> bool ) -> option:: t < uint > {
628
+ fn position_pred < T > ( v : [ T ] , f : fn ( T ) -> bool ) -> option < uint > {
629
629
let i: uint = 0 u;
630
630
while i < len ( v) { if f ( v[ i] ) { ret some :: < uint > ( i) ; } i += 1 u; }
631
631
ret none;
@@ -1010,7 +1010,7 @@ mod tests {
1010
1010
1011
1011
pure fn is_equal ( & & x: uint , & & y: uint ) -> bool { ret x == y; }
1012
1012
1013
- fn square_if_odd ( & & n: uint ) -> option:: t < uint > {
1013
+ fn square_if_odd ( & & n: uint ) -> option < uint > {
1014
1014
ret if n % 2 u == 1 u { some ( n * n) } else { none } ;
1015
1015
}
1016
1016
@@ -1267,7 +1267,7 @@ mod tests {
1267
1267
assert ( w[ 1 ] == 9 u) ;
1268
1268
assert ( w[ 2 ] == 25 u) ;
1269
1269
1270
- fn halve ( & & i: int ) -> option:: t < int > {
1270
+ fn halve ( & & i: int ) -> option < int > {
1271
1271
if i % 2 == 0 {
1272
1272
ret option:: some :: < int > ( i / 2 ) ;
1273
1273
} else { ret option:: none :: < int > ; }
0 commit comments