about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@gmail.com>2019-11-04 14:05:15 +0200
committerMikhail Zabaluev <mikhail.zabaluev@gmail.com>2019-12-22 08:35:10 +0200
commit6f0672c08b7609c7ed77245a3feea3040221b804 (patch)
treefc13c09a06ea8f13db21a48d1cbf806fe37c491e
parent9a99a2159bb57ee0f1a52bb3f989a903df2f8cb4 (diff)
downloadrust-6f0672c08b7609c7ed77245a3feea3040221b804.tar.gz
rust-6f0672c08b7609c7ed77245a3feea3040221b804.zip
Rename Result::unwrap_infallible to into_ok
-rw-r--r--src/libcore/result.rs4
-rw-r--r--src/libcore/tests/result.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index ed3b37ad2a5..ea2dd77f4ef 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -1109,11 +1109,11 @@ impl<T, E: Into<!>> Result<T, E> {
     ///     Ok("this is fine".into())
     /// }
     ///
-    /// let s: String = only_good_news().unwrap_infallible();
+    /// let s: String = only_good_news().into_ok();
     /// println!("{}", s);
     /// ```
     #[inline]
-    pub fn unwrap_infallible(self) -> T {
+    pub fn into_ok(self) -> T {
         match self {
             Ok(x) => x,
             Err(e) => e.into(),
diff --git a/src/libcore/tests/result.rs b/src/libcore/tests/result.rs
index 8d17790af56..cac15a6b324 100644
--- a/src/libcore/tests/result.rs
+++ b/src/libcore/tests/result.rs
@@ -198,12 +198,12 @@ pub fn test_unwrap_or_default() {
 }
 
 #[test]
-pub fn test_unwrap_infallible() {
+pub fn test_into_ok() {
     fn infallible_op() -> Result<isize, !> {
         Ok(666)
     }
 
-    assert_eq!(infallible_op().unwrap_infallible(), 666);
+    assert_eq!(infallible_op().into_ok(), 666);
 
     enum MyNeverToken {}
     impl From<MyNeverToken> for ! {
@@ -216,7 +216,7 @@ pub fn test_unwrap_infallible() {
         Ok(667)
     }
 
-    assert_eq!(infallible_op2().unwrap_infallible(), 667);
+    assert_eq!(infallible_op2().into_ok(), 667);
 }
 
 #[test]