Skip to content

Commit 31bd061

Browse files
authored
Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
Remove unstable Result::into_ok_or_err Pending FCP: rust-lang/rust#82223 (comment) ```@rustbot``` label +waiting-on-fcp
2 parents aadfec1 + 3914ccd commit 31bd061

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
lines changed

core/src/result.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,40 +1776,6 @@ impl<T, E> Result<Result<T, E>, E> {
17761776
}
17771777
}
17781778

1779-
impl<T> Result<T, T> {
1780-
/// Returns the [`Ok`] value if `self` is `Ok`, and the [`Err`] value if
1781-
/// `self` is `Err`.
1782-
///
1783-
/// In other words, this function returns the value (the `T`) of a
1784-
/// `Result<T, T>`, regardless of whether or not that result is `Ok` or
1785-
/// `Err`.
1786-
///
1787-
/// This can be useful in conjunction with APIs such as
1788-
/// [`Atomic*::compare_exchange`], or [`slice::binary_search`], but only in
1789-
/// cases where you don't care if the result was `Ok` or not.
1790-
///
1791-
/// [`Atomic*::compare_exchange`]: crate::sync::atomic::AtomicBool::compare_exchange
1792-
///
1793-
/// # Examples
1794-
///
1795-
/// ```
1796-
/// #![feature(result_into_ok_or_err)]
1797-
/// let ok: Result<u32, u32> = Ok(3);
1798-
/// let err: Result<u32, u32> = Err(4);
1799-
///
1800-
/// assert_eq!(ok.into_ok_or_err(), 3);
1801-
/// assert_eq!(err.into_ok_or_err(), 4);
1802-
/// ```
1803-
#[inline]
1804-
#[unstable(feature = "result_into_ok_or_err", reason = "newly added", issue = "82223")]
1805-
pub const fn into_ok_or_err(self) -> T {
1806-
match self {
1807-
Ok(v) => v,
1808-
Err(v) => v,
1809-
}
1810-
}
1811-
}
1812-
18131779
// This is a separate function to reduce the code size of the methods
18141780
#[cfg(not(feature = "panic_immediate_abort"))]
18151781
#[inline(never)]

core/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#![feature(const_pin)]
7676
#![feature(never_type)]
7777
#![feature(unwrap_infallible)]
78-
#![feature(result_into_ok_or_err)]
7978
#![feature(pointer_byte_offsets)]
8079
#![feature(portable_simd)]
8180
#![feature(ptr_metadata)]

core/tests/result.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,6 @@ fn test_unwrap_or() {
9595
assert_eq!(ok_err.unwrap_or(50), 50);
9696
}
9797

98-
#[test]
99-
fn test_ok_or_err() {
100-
let ok: Result<isize, isize> = Ok(100);
101-
let err: Result<isize, isize> = Err(200);
102-
103-
assert_eq!(ok.into_ok_or_err(), 100);
104-
assert_eq!(err.into_ok_or_err(), 200);
105-
}
106-
10798
#[test]
10899
fn test_unwrap_or_else() {
109100
fn handler(msg: &'static str) -> isize {

0 commit comments

Comments
 (0)