about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-05-06 19:32:18 -0400
committerCorey Farwell <coreyf@rwell.org>2016-05-09 08:40:57 -0400
commit62b19c627ebde2bbfa6021de146c502124da7975 (patch)
tree1dddc25ccb212bba5ceb77a9613bee56368082af
parent50909f2d5036e59871f779500dd722a62421c13c (diff)
downloadrust-62b19c627ebde2bbfa6021de146c502124da7975.tar.gz
rust-62b19c627ebde2bbfa6021de146c502124da7975.zip
Utilize `Result::unwrap_err` in more places.
-rw-r--r--src/libcollectionstest/string.rs2
-rw-r--r--src/libserialize/json.rs2
-rw-r--r--src/libstd/fs.rs2
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/sync/mpsc/mod.rs2
-rw-r--r--src/libterm/terminfo/parm.rs16
-rw-r--r--src/test/run-make/static-unwinding/main.rs2
-rw-r--r--src/test/run-pass/command-before-exec.rs2
-rw-r--r--src/test/run-pass/no-landing-pads.rs2
-rw-r--r--src/test/run-pass/panic-recover-propagate.rs4
-rw-r--r--src/test/run-pass/sepcomp-unwind.rs2
-rw-r--r--src/test/run-pass/terminate-in-initializer.rs4
-rw-r--r--src/test/run-pass/unit-like-struct-drop-run.rs2
13 files changed, 22 insertions, 22 deletions
diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs
index d71529023f4..c2eafa1b90f 100644
--- a/src/libcollectionstest/string.rs
+++ b/src/libcollectionstest/string.rs
@@ -52,7 +52,7 @@ fn test_from_utf8() {
                String::from("ศไทย中华Việt Nam"));
 
     let xs = b"hello\xFF".to_vec();
-    let err = String::from_utf8(xs).err().unwrap();
+    let err = String::from_utf8(xs).unwrap_err();
     assert_eq!(err.into_bytes(), b"hello\xff".to_vec());
 }
 
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index a7d72351566..90b2c611603 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -3948,7 +3948,7 @@ mod tests {
         let mut mem_buf = string::String::new();
         let mut encoder = Encoder::new(&mut mem_buf);
         let result = hm.encode(&mut encoder);
-        match result.err().unwrap() {
+        match result.unwrap_err() {
             EncoderError::BadHashmapKey => (),
             _ => panic!("expected bad hash map key")
         }
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index 03ebaa59ca5..c19fe1e1d26 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -1772,7 +1772,7 @@ mod tests {
         let tmpdir = tmpdir();
         let dir = &tmpdir.join("mkdir_error_twice");
         check!(fs::create_dir(dir));
-        let e = fs::create_dir(dir).err().unwrap();
+        let e = fs::create_dir(dir).unwrap_err();
         assert_eq!(e.kind(), ErrorKind::AlreadyExists);
     }
 
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 632ef3db804..a92ca95f4ee 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -1127,7 +1127,7 @@ mod tests {
             let mut writer = BufWriter::new(PanicWriter);
             let _ = writer.write(b"hello world");
             let _ = writer.flush();
-        }).join().err().unwrap();
+        }).join().unwrap_err();
 
         assert_eq!(WRITES.load(Ordering::SeqCst), 1);
     }
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index dbcc2bc95bc..63b659d8db3 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -535,7 +535,7 @@ impl<T> Sender<T> {
     ///
     /// // This send will fail because the receiver is gone
     /// drop(rx);
-    /// assert_eq!(tx.send(1).err().unwrap().0, 1);
+    /// assert_eq!(tx.send(1).unwrap_err().0, 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn send(&self, t: T) -> Result<(), SendError<T>> {
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index 60b5dffac59..fbc6bfb6c8d 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -594,7 +594,7 @@ mod test {
             assert!(res.is_ok(),
                     "Op {} failed with 1 stack entry: {}",
                     cap,
-                    res.err().unwrap());
+                    res.unwrap_err());
         }
         let caps = ["%+", "%-", "%*", "%/", "%m", "%&", "%|", "%A", "%O"];
         for &cap in caps.iter() {
@@ -610,7 +610,7 @@ mod test {
             assert!(res.is_ok(),
                     "Binop {} failed with 2 stack entries: {}",
                     cap,
-                    res.err().unwrap());
+                    res.unwrap_err());
         }
     }
 
@@ -625,15 +625,15 @@ mod test {
         for &(op, bs) in v.iter() {
             let s = format!("%{{1}}%{{2}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.err().unwrap());
+            assert!(res.is_ok(), res.unwrap_err());
             assert_eq!(res.unwrap(), vec![b'0' + bs[0]]);
             let s = format!("%{{1}}%{{1}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.err().unwrap());
+            assert!(res.is_ok(), res.unwrap_err());
             assert_eq!(res.unwrap(), vec![b'0' + bs[1]]);
             let s = format!("%{{2}}%{{1}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.err().unwrap());
+            assert!(res.is_ok(), res.unwrap_err());
             assert_eq!(res.unwrap(), vec![b'0' + bs[2]]);
         }
     }
@@ -643,13 +643,13 @@ mod test {
         let mut vars = Variables::new();
         let s = b"\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m";
         let res = expand(s, &[Number(1)], &mut vars);
-        assert!(res.is_ok(), res.err().unwrap());
+        assert!(res.is_ok(), res.unwrap_err());
         assert_eq!(res.unwrap(), "\\E[31m".bytes().collect::<Vec<_>>());
         let res = expand(s, &[Number(8)], &mut vars);
-        assert!(res.is_ok(), res.err().unwrap());
+        assert!(res.is_ok(), res.unwrap_err());
         assert_eq!(res.unwrap(), "\\E[90m".bytes().collect::<Vec<_>>());
         let res = expand(s, &[Number(42)], &mut vars);
-        assert!(res.is_ok(), res.err().unwrap());
+        assert!(res.is_ok(), res.unwrap_err());
         assert_eq!(res.unwrap(), "\\E[38;5;42m".bytes().collect::<Vec<_>>());
     }
 
diff --git a/src/test/run-make/static-unwinding/main.rs b/src/test/run-make/static-unwinding/main.rs
index ba4860be91d..1cd785334f6 100644
--- a/src/test/run-make/static-unwinding/main.rs
+++ b/src/test/run-make/static-unwinding/main.rs
@@ -25,7 +25,7 @@ fn main() {
     thread::spawn(move|| {
         let _a = A;
         lib::callback(|| panic!());
-    }).join().err().unwrap();
+    }).join().unwrap_err();
 
     unsafe {
         assert_eq!(lib::statik, 1);
diff --git a/src/test/run-pass/command-before-exec.rs b/src/test/run-pass/command-before-exec.rs
index 16560637b69..72f952fb6c0 100644
--- a/src/test/run-pass/command-before-exec.rs
+++ b/src/test/run-pass/command-before-exec.rs
@@ -62,7 +62,7 @@ fn main() {
 
     let output = Command::new(&me).arg("bad").before_exec(|| {
         Err(Error::from_raw_os_error(102))
-    }).output().err().unwrap();
+    }).output().unwrap_err();
     assert_eq!(output.raw_os_error(), Some(102));
 
     let pid = unsafe { libc::getpid() };
diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs
index 8445bccf134..e718046ebbc 100644
--- a/src/test/run-pass/no-landing-pads.rs
+++ b/src/test/run-pass/no-landing-pads.rs
@@ -27,6 +27,6 @@ fn main() {
     thread::spawn(move|| -> () {
         let _a = A;
         panic!();
-    }).join().err().unwrap();
+    }).join().unwrap_err();
     assert!(unsafe { !HIT });
 }
diff --git a/src/test/run-pass/panic-recover-propagate.rs b/src/test/run-pass/panic-recover-propagate.rs
index d420ef99863..2c87c6b9268 100644
--- a/src/test/run-pass/panic-recover-propagate.rs
+++ b/src/test/run-pass/panic-recover-propagate.rs
@@ -28,10 +28,10 @@ fn main() {
             panic!("hi there");
         });
 
-        panic::propagate(result.err().unwrap());
+        panic::propagate(result.unwrap_err());
     }).join();
 
-    let msg = *result.err().unwrap().downcast::<&'static str>().unwrap();
+    let msg = *result.unwrap_err().downcast::<&'static str>().unwrap();
     assert_eq!("hi there", msg);
     assert_eq!(1, A.load(Ordering::SeqCst));
 }
diff --git a/src/test/run-pass/sepcomp-unwind.rs b/src/test/run-pass/sepcomp-unwind.rs
index 96e9c1ed2cc..3a93845a062 100644
--- a/src/test/run-pass/sepcomp-unwind.rs
+++ b/src/test/run-pass/sepcomp-unwind.rs
@@ -39,5 +39,5 @@ mod b {
 }
 
 fn main() {
-    thread::spawn(move|| { ::b::g() }).join().err().unwrap();
+    thread::spawn(move|| { ::b::g() }).join().unwrap_err();
 }
diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs
index 2875f73fc6c..c9133bae854 100644
--- a/src/test/run-pass/terminate-in-initializer.rs
+++ b/src/test/run-pass/terminate-in-initializer.rs
@@ -24,13 +24,13 @@ fn test_ret() { let _x: Box<isize> = return; }
 
 fn test_panic() {
     fn f() { let _x: Box<isize> = panic!(); }
-    thread::spawn(move|| f() ).join().err().unwrap();
+    thread::spawn(move|| f() ).join().unwrap_err();
 }
 
 fn test_panic_indirect() {
     fn f() -> ! { panic!(); }
     fn g() { let _x: Box<isize> = f(); }
-    thread::spawn(move|| g() ).join().err().unwrap();
+    thread::spawn(move|| g() ).join().unwrap_err();
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs
index eaee3505a67..ec37be9420d 100644
--- a/src/test/run-pass/unit-like-struct-drop-run.rs
+++ b/src/test/run-pass/unit-like-struct-drop-run.rs
@@ -30,6 +30,6 @@ pub fn main() {
         let _b = Foo;
     }).join();
 
-    let s = x.err().unwrap().downcast::<&'static str>().unwrap();
+    let s = x.unwrap_err().downcast::<&'static str>().unwrap();
     assert_eq!(&**s, "This panic should happen.");
 }