diff options
| author | Thom Chiovoloni <chiovolonit@gmail.com> | 2021-02-17 08:54:52 -0800 |
|---|---|---|
| committer | Thom Chiovoloni <chiovolonit@gmail.com> | 2021-02-17 08:54:52 -0800 |
| commit | 2711b011e6b2c06c6f289a8a2362c3af31dbc32c (patch) | |
| tree | 33addeeb18c184a5c9abc789518f11f562eec17f /library | |
| parent | 7d303661cdfbf96768b341f500acde83dc052342 (diff) | |
| download | rust-2711b011e6b2c06c6f289a8a2362c3af31dbc32c.tar.gz rust-2711b011e6b2c06c6f289a8a2362c3af31dbc32c.zip | |
Rename Result::ok_or_err to Result::into_ok_or_err
Diffstat (limited to 'library')
| -rw-r--r-- | library/core/src/result.rs | 10 | ||||
| -rw-r--r-- | library/core/tests/lib.rs | 2 | ||||
| -rw-r--r-- | library/core/tests/result.rs | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/library/core/src/result.rs b/library/core/src/result.rs index bbbf1b412a3..9cfa7b6211a 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1294,16 +1294,16 @@ impl<T> Result<T, T> { /// # Examples /// /// ``` - /// #![feature(ok_or_err)] + /// #![feature(result_into_ok_or_err)] /// let ok: Result<u32, u32> = Ok(3); /// let err: Result<u32, u32> = Err(4); /// - /// assert_eq!(ok.ok_or_err(), 3); - /// assert_eq!(err.ok_or_err(), 4); + /// assert_eq!(ok.into_ok_or_err(), 3); + /// assert_eq!(err.into_ok_or_err(), 4); /// ``` #[inline] - #[unstable(feature = "ok_or_err", reason = "newly added", issue = "none")] - pub const fn ok_or_err(self) -> T { + #[unstable(feature = "result_into_ok_or_err", reason = "newly added", issue = "none")] + pub const fn into_ok_or_err(self) -> T { match self { Ok(v) => v, Err(v) => v, diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 5cd6e9efd9e..34e05760db2 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -65,7 +65,7 @@ #![feature(never_type)] #![feature(unwrap_infallible)] #![feature(option_result_unwrap_unchecked)] -#![feature(ok_or_err)] +#![feature(result_into_ok_or_err)] #![feature(option_unwrap_none)] #![feature(peekable_peek_mut)] #![feature(once_cell)] diff --git a/library/core/tests/result.rs b/library/core/tests/result.rs index 53087eec499..5fcd7b4d3a3 100644 --- a/library/core/tests/result.rs +++ b/library/core/tests/result.rs @@ -100,8 +100,8 @@ fn test_ok_or_err() { let ok: Result<isize, isize> = Ok(100); let err: Result<isize, isize> = Err(200); - assert_eq!(ok.ok_or_err(), 100); - assert_eq!(err.ok_or_err(), 200); + assert_eq!(ok.into_ok_or_err(), 100); + assert_eq!(err.into_ok_or_err(), 200); } #[test] |
