diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-06-16 16:55:46 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-06-16 16:55:46 -0700 |
| commit | b84fffaa4e0e672b4653a7832d75a2dc120040aa (patch) | |
| tree | ad8e6854d11f6627b7afc9b8d14f525580beff55 /src/lib/either.rs | |
| parent | eb9969f54699924e4373f6c447aaeb4dd041b0dd (diff) | |
| download | rust-b84fffaa4e0e672b4653a7832d75a2dc120040aa.tar.gz rust-b84fffaa4e0e672b4653a7832d75a2dc120040aa.zip | |
Reformat a bunch of recent churn.
Diffstat (limited to 'src/lib/either.rs')
| -rw-r--r-- | src/lib/either.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lib/either.rs b/src/lib/either.rs index 12ccbb2bbfb..0af528d7e5f 100644 --- a/src/lib/either.rs +++ b/src/lib/either.rs @@ -1,17 +1,15 @@ + import option; import option::some; import option::none; -tag t[T, U] { - left(T); - right(U); -} +tag t[T, U] { left(T); right(U); } -type operator[T, U] = fn(&T) -> U; +type operator[T, U] = fn(&T) -> U ; -fn either[T, U, V](&operator[T, V] f_left, - &operator[U, V] f_right, - &t[T, U] value) -> V { +fn either[T, U, + V](&operator[T, V] f_left, &operator[U, V] f_right, &t[T, U] value) + -> V { alt (value) { case (left(?l)) { f_left(l) } case (right(?r)) { f_right(r) } @@ -23,7 +21,7 @@ fn lefts[T, U](&vec[t[T, U]] eithers) -> vec[T] { for (t[T, U] elt in eithers) { alt (elt) { case (left(?l)) { result += [l] } - case (_) { /* fallthrough */ } + case (_) {/* fallthrough */ } } } ret result; @@ -34,7 +32,7 @@ fn rights[T, U](&vec[t[T, U]] eithers) -> vec[U] { for (t[T, U] elt in eithers) { alt (elt) { case (right(?r)) { result += [r] } - case (_) { /* fallthrough */ } + case (_) {/* fallthrough */ } } } ret result; @@ -51,7 +49,6 @@ fn partition[T, U](&vec[t[T, U]] eithers) -> tup(vec[T], vec[U]) { } ret tup(lefts, rights); } - // // Local Variables: // mode: rust |
