Skip to content

Commit 1ead8aa

Browse files
committed
Merge pull request #3954 from burg/result-chain
Fix Result::chain, Result::chain_err to not require Copy bounds.
2 parents fe02814 + 37ed7fc commit 1ead8aa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libcore/result.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ pub pure fn to_either<T: Copy, U: Copy>(res: &Result<U, T>)
103103
* ok(parse_bytes(buf))
104104
* }
105105
*/
106-
pub fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(t: T)
106+
pub fn chain<T, U, V>(res: Result<T, V>, op: fn(t: T)
107107
-> Result<U, V>) -> Result<U, V> {
108108
match move res {
109109
Ok(move t) => op(move t),
110-
Err(move e) => Err(e)
110+
Err(move e) => Err(move e)
111111
}
112112
}
113113

@@ -119,13 +119,13 @@ pub fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(t: T)
119119
* immediately returned. This function can be used to pass through a
120120
* successful result while handling an error.
121121
*/
122-
pub fn chain_err<T: Copy, U: Copy, V: Copy>(
122+
pub fn chain_err<T, U, V>(
123123
res: Result<T, V>,
124124
op: fn(t: V) -> Result<T, U>)
125125
-> Result<T, U> {
126126
match move res {
127-
Ok(move t) => Ok(t),
128-
Err(move v) => op(v)
127+
Ok(move t) => Ok(move t),
128+
Err(move v) => op(move v)
129129
}
130130
}
131131

0 commit comments

Comments
 (0)