Skip to content

Commit 46cf662

Browse files
committed
---
yaml --- r: 64792 b: refs/heads/snap-stage3 c: e308167 h: refs/heads/master v: v3
1 parent 5f8984f commit 46cf662

File tree

4 files changed

+18
-26
lines changed

4 files changed

+18
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 4eb95f6d1c22419b50980d0bf8effc6e2f22feb5
4+
refs/heads/snap-stage3: e308167a2fe558924fcebcc99358c057ae0b90b4
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/workcache.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use std::cell::Cell;
2222
use std::comm::{PortOne, oneshot, send_one, recv_one};
2323
use std::either::{Either, Left, Right};
2424
use std::io;
25-
use std::result;
2625
use std::run;
2726
use std::task;
2827

@@ -208,7 +207,7 @@ fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str {
208207
// FIXME(#5121)
209208
fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
210209
do io::with_str_reader(s) |rdr| {
211-
let j = result::unwrap(json::from_reader(rdr));
210+
let j = json::from_reader(rdr).unwrap();
212211
let mut decoder = json::Decoder(j);
213212
Decodable::decode(&mut decoder)
214213
}

branches/snap-stage3/src/libstd/io.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,12 +1851,10 @@ mod tests {
18511851
~"A hoopy frood who really knows where his towel is.";
18521852
debug!(frood.clone());
18531853
{
1854-
let out: @io::Writer =
1855-
result::unwrap(
1856-
io::file_writer(tmpfile, [io::Create, io::Truncate]));
1854+
let out: @io::Writer = io::file_writer(tmpfile, [io::Create, io::Truncate]).unwrap();
18571855
out.write_str(frood);
18581856
}
1859-
let inp: @io::Reader = result::unwrap(io::file_reader(tmpfile));
1857+
let inp: @io::Reader = io::file_reader(tmpfile).unwrap();
18601858
let frood2: ~str = inp.read_c_str();
18611859
debug!(frood2.clone());
18621860
assert_eq!(frood, frood2);

branches/snap-stage3/src/libstd/result.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,23 @@ impl<T, E> Result<T, E> {
242242
}
243243
}
244244

245+
/// Unwraps a result, assuming it is an `ok(T)`
245246
#[inline]
246-
pub fn unwrap(self) -> T { unwrap(self) }
247+
pub fn unwrap(self) -> T {
248+
match self {
249+
Ok(t) => t,
250+
Err(_) => fail!("unwrap called on an err result")
251+
}
252+
}
247253

254+
/// Unwraps a result, assuming it is an `err(U)`
248255
#[inline]
249-
pub fn unwrap_err(self) -> E { unwrap_err(self) }
256+
pub fn unwrap_err(self) -> E {
257+
match self {
258+
Err(u) => u,
259+
Ok(_) => fail!("unwrap called on an ok result")
260+
}
261+
}
250262

251263
#[inline]
252264
pub fn chain<U>(self, op: &fn(T) -> Result<U,E>) -> Result<U,E> {
@@ -375,23 +387,6 @@ pub fn iter_vec2<S,T,U>(ss: &[S], ts: &[T],
375387
return Ok(());
376388
}
377389

378-
/// Unwraps a result, assuming it is an `ok(T)`
379-
#[inline]
380-
pub fn unwrap<T, U>(res: Result<T, U>) -> T {
381-
match res {
382-
Ok(t) => t,
383-
Err(_) => fail!("unwrap called on an err result")
384-
}
385-
}
386-
387-
/// Unwraps a result, assuming it is an `err(U)`
388-
#[inline]
389-
pub fn unwrap_err<T, U>(res: Result<T, U>) -> U {
390-
match res {
391-
Err(u) => u,
392-
Ok(_) => fail!("unwrap called on an ok result")
393-
}
394-
}
395390

396391
#[cfg(test)]
397392
mod tests {

0 commit comments

Comments
 (0)