Skip to content

Commit 02c0bab

Browse files
committed
---
yaml --- r: 10679 b: refs/heads/snap-stage3 c: 0cf730e h: refs/heads/master i: 10677: 630ae21 10675: ddd50ed 10671: 9400c74 v: v3
1 parent f07fec9 commit 02c0bab

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ce7b8037286731117e7709974595f1ae5bc67bce
4+
refs/heads/snap-stage3: 0cf730ed2a94718229fd2c0a3ded8fc2b18ee6ce
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/libcore/result.rs

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,11 @@ fn map_err<T: copy, E, F: copy>(res: result<T, E>, op: fn(E) -> F)
180180
}
181181
}
182182

183-
impl extensions<T:copy, E:copy> for result<T,E> {
184-
fn get() -> T { get(self) }
185-
186-
fn get_err() -> E { get_err(self) }
187-
183+
impl extensions<T, E> for result<T, E> {
188184
fn is_success() -> bool { is_success(self) }
189185

190186
fn is_failure() -> bool { is_failure(self) }
191187

192-
fn chain<U:copy>(op: fn(T) -> result<U,E>) -> result<U,E> {
193-
chain(self, op)
194-
}
195-
196-
fn chain_err<F:copy>(op: fn(E) -> result<T,F>) -> result<T,F> {
197-
chain_err(self, op)
198-
}
199-
200188
fn iter(f: fn(T)) {
201189
alt self {
202190
ok(t) { f(t) }
@@ -210,19 +198,37 @@ impl extensions<T:copy, E:copy> for result<T,E> {
210198
err(e) { f(e) }
211199
}
212200
}
201+
}
202+
203+
impl extensions<T:copy, E> for result<T, E> {
204+
fn get() -> T { get(self) }
205+
206+
fn map_err<F:copy>(op: fn(E) -> F) -> result<T,F> {
207+
alt self {
208+
ok(t) { ok(t) }
209+
err(e) { err(op(e)) }
210+
}
211+
}
212+
}
213+
214+
impl extensions<T, E:copy> for result<T, E> {
215+
fn get_err() -> E { get_err(self) }
213216

214217
fn map<U:copy>(op: fn(T) -> U) -> result<U,E> {
215218
alt self {
216219
ok(t) { ok(op(t)) }
217220
err(e) { err(e) }
218221
}
219222
}
223+
}
220224

221-
fn map_err<F:copy>(op: fn(E) -> F) -> result<T,F> {
222-
alt self {
223-
ok(t) { ok(t) }
224-
err(e) { err(op(e)) }
225-
}
225+
impl extensions<T:copy, E:copy> for result<T,E> {
226+
fn chain<U:copy>(op: fn(T) -> result<U,E>) -> result<U,E> {
227+
chain(self, op)
228+
}
229+
230+
fn chain_err<F:copy>(op: fn(E) -> result<T,F>) -> result<T,F> {
231+
chain_err(self, op)
226232
}
227233
}
228234

0 commit comments

Comments
 (0)