Skip to content

Commit a3f845d

Browse files
committed
Made Result.get, get_ref, is_ok, is_err, and iter methods pure.
Note that the function versions were already pure.
1 parent d999588 commit a3f845d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/result.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ pub fn map_err<T: Copy, E, F: Copy>(res: &Result<T, E>, op: fn((&E)) -> F)
204204
}
205205

206206
impl<T, E> Result<T, E> {
207-
fn get_ref(&self) -> &self/T { get_ref(self) }
207+
pure fn get_ref(&self) -> &self/T { get_ref(self) }
208208

209-
fn is_ok() -> bool { is_ok(&self) }
209+
pure fn is_ok() -> bool { is_ok(&self) }
210210

211-
fn is_err() -> bool { is_err(&self) }
211+
pure fn is_err() -> bool { is_err(&self) }
212212

213-
fn iter(f: fn((&T))) {
213+
pure fn iter(f: fn((&T))) {
214214
match self {
215215
Ok(ref t) => f(t),
216216
Err(_) => ()
@@ -226,7 +226,7 @@ impl<T, E> Result<T, E> {
226226
}
227227

228228
impl<T: Copy, E> Result<T, E> {
229-
fn get() -> T { get(&self) }
229+
pure fn get() -> T { get(&self) }
230230

231231
fn map_err<F:Copy>(op: fn((&E)) -> F) -> Result<T,F> {
232232
match self {
@@ -237,7 +237,7 @@ impl<T: Copy, E> Result<T, E> {
237237
}
238238

239239
impl<T, E: Copy> Result<T, E> {
240-
fn get_err() -> E { get_err(&self) }
240+
pure fn get_err() -> E { get_err(&self) }
241241

242242
fn map<U:Copy>(op: fn((&T)) -> U) -> Result<U,E> {
243243
match self {

0 commit comments

Comments
 (0)