From 37ed7fcaae1477cd85985886b5f8a4514bf98d0e Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Mon, 12 Nov 2012 17:53:08 -0800 Subject: [PATCH] Fix Result::chain, Result::chain_err to not require Copy bounds. --- src/libcore/result.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 3015e893700..2df2974d0ba 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -103,11 +103,11 @@ pub pure fn to_either(res: &Result) * ok(parse_bytes(buf)) * } */ -pub fn chain(res: Result, op: fn(t: T) +pub fn chain(res: Result, op: fn(t: T) -> Result) -> Result { match move res { Ok(move t) => op(move t), - Err(move e) => Err(e) + Err(move e) => Err(move e) } } @@ -119,13 +119,13 @@ pub fn chain(res: Result, op: fn(t: T) * immediately returned. This function can be used to pass through a * successful result while handling an error. */ -pub fn chain_err( +pub fn chain_err( res: Result, op: fn(t: V) -> Result) -> Result { match move res { - Ok(move t) => Ok(t), - Err(move v) => op(v) + Ok(move t) => Ok(move t), + Err(move v) => op(move v) } }