Convert alt to match. Stop parsing alt

This commit is contained in:
Brian Anderson
2012-08-06 12:34:08 -07:00
parent d3a9bb1bd4
commit ecaf9e39c9
359 changed files with 2938 additions and 2915 deletions

View File

@@ -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); }
}