diff --git a/src/libstd/result.rs b/src/libstd/result.rs index acc4ece8fd5..7b660ed8624 100644 --- a/src/libstd/result.rs +++ b/src/libstd/result.rs @@ -47,22 +47,6 @@ pub fn get(res: &Result) -> T { } } -/** - * Get a reference to the value out of a successful result - * - * # Failure - * - * If the result is an error - */ -#[inline] -pub fn get_ref<'a, T, U>(res: &'a Result) -> &'a T { - match *res { - Ok(ref t) => t, - Err(ref the_err) => - fail!("get_ref called on error result: %?", *the_err) - } -} - /** * Get the value out of an error result * @@ -229,8 +213,21 @@ pub fn map_err(res: &Result, op: &fn(&E) -> F) } impl Result { + /** + * Get a reference to the value out of a successful result + * + * # Failure + * + * If the result is an error + */ #[inline] - pub fn get_ref<'a>(&'a self) -> &'a T { get_ref(self) } + pub fn get_ref<'a>(&'a self) -> &'a T { + match *self { + Ok(ref t) => t, + Err(ref the_err) => + fail!("get_ref called on error result: %?", *the_err) + } + } #[inline] pub fn is_ok(&self) -> bool { is_ok(self) }