Convert alt to match. Stop parsing alt
This commit is contained in:
@@ -356,7 +356,7 @@ fn split<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] {
|
||||
let mut start = 0u;
|
||||
let mut result = ~[];
|
||||
while start < ln {
|
||||
alt position_between(v, start, ln, f) {
|
||||
match position_between(v, start, ln, f) {
|
||||
none => break,
|
||||
some(i) => {
|
||||
push(result, slice(v, start, i));
|
||||
@@ -380,7 +380,7 @@ fn splitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] {
|
||||
let mut count = n;
|
||||
let mut result = ~[];
|
||||
while start < ln && count > 0u {
|
||||
alt position_between(v, start, ln, f) {
|
||||
match position_between(v, start, ln, f) {
|
||||
none => break,
|
||||
some(i) => {
|
||||
push(result, slice(v, start, i));
|
||||
@@ -405,7 +405,7 @@ fn rsplit<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] {
|
||||
let mut end = ln;
|
||||
let mut result = ~[];
|
||||
while end > 0u {
|
||||
alt rposition_between(v, 0u, end, f) {
|
||||
match rposition_between(v, 0u, end, f) {
|
||||
none => break,
|
||||
some(i) => {
|
||||
push(result, slice(v, i + 1u, end));
|
||||
@@ -429,7 +429,7 @@ fn rsplitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] {
|
||||
let mut count = n;
|
||||
let mut result = ~[];
|
||||
while end > 0u && count > 0u {
|
||||
alt rposition_between(v, 0u, end, f) {
|
||||
match rposition_between(v, 0u, end, f) {
|
||||
none => break,
|
||||
some(i) => {
|
||||
push(result, slice(v, i + 1u, end));
|
||||
@@ -713,7 +713,7 @@ pure fn filter_map<T, U: copy>(v: &[T], f: fn(T) -> option<U>)
|
||||
-> ~[U] {
|
||||
let mut result = ~[];
|
||||
for each(v) |elem| {
|
||||
alt f(elem) {
|
||||
match f(elem) {
|
||||
none => {/* no-op */ }
|
||||
some(result_elem) => unsafe { push(result, result_elem); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user