about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcore/result.rs4
-rw-r--r--src/libcoretest/result.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 23e936a75d7..ec0c19d36e4 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -641,9 +641,9 @@ impl<T, E> Result<T, E> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn or(self, res: Result<T, E>) -> Result<T, E> {
+    pub fn or<F>(self, res: Result<T, F>) -> Result<T, F> {
         match self {
-            Ok(_) => self,
+            Ok(v) => Ok(v),
             Err(_) => res,
         }
     }
diff --git a/src/libcoretest/result.rs b/src/libcoretest/result.rs
index ab7b5101e72..10cc3ad6424 100644
--- a/src/libcoretest/result.rs
+++ b/src/libcoretest/result.rs
@@ -36,10 +36,10 @@ pub fn test_and_then() {
 
 #[test]
 pub fn test_or() {
-    assert_eq!(op1().or(Ok(667)).unwrap(), 666);
+    assert_eq!(op1().or(Ok::<_, &'static str>(667)).unwrap(), 666);
     assert_eq!(op1().or(Err("bad")).unwrap(), 666);
 
-    assert_eq!(op2().or(Ok(667)).unwrap(), 667);
+    assert_eq!(op2().or(Ok::<_, &'static str>(667)).unwrap(), 667);
     assert_eq!(op2().or(Err("bad")).unwrap_err(), "bad");
 }