diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 3c6622ba69dd..a5badd92610c 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -180,23 +180,11 @@ fn map_err(res: result, op: fn(E) -> F) } } -impl extensions for result { - fn get() -> T { get(self) } - - fn get_err() -> E { get_err(self) } - +impl extensions for result { fn is_success() -> bool { is_success(self) } fn is_failure() -> bool { is_failure(self) } - fn chain(op: fn(T) -> result) -> result { - chain(self, op) - } - - fn chain_err(op: fn(E) -> result) -> result { - chain_err(self, op) - } - fn iter(f: fn(T)) { alt self { ok(t) { f(t) } @@ -210,6 +198,21 @@ impl extensions for result { err(e) { f(e) } } } +} + +impl extensions for result { + fn get() -> T { get(self) } + + fn map_err(op: fn(E) -> F) -> result { + alt self { + ok(t) { ok(t) } + err(e) { err(op(e)) } + } + } +} + +impl extensions for result { + fn get_err() -> E { get_err(self) } fn map(op: fn(T) -> U) -> result { alt self { @@ -217,12 +220,15 @@ impl extensions for result { err(e) { err(e) } } } +} - fn map_err(op: fn(E) -> F) -> result { - alt self { - ok(t) { ok(t) } - err(e) { err(op(e)) } - } +impl extensions for result { + fn chain(op: fn(T) -> result) -> result { + chain(self, op) + } + + fn chain_err(op: fn(E) -> result) -> result { + chain_err(self, op) } }