mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
Rollup merge of #60376 - lzutao:stabilize-option_xor, r=SimonSapin
Stabilize Option::xor FCP done in https://github.com/rust-lang/rust/issues/50512#issuecomment-469527554 . Closes #50512 .
This commit is contained in:
@@ -725,8 +725,6 @@ pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(option_xor)]
|
||||
///
|
||||
/// let x = Some(2);
|
||||
/// let y: Option<u32> = None;
|
||||
/// assert_eq!(x.xor(y), Some(2));
|
||||
@@ -744,7 +742,7 @@ pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
|
||||
/// assert_eq!(x.xor(y), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "option_xor", issue = "50512")]
|
||||
#[stable(feature = "option_xor", since = "1.37.0")]
|
||||
pub fn xor(self, optb: Option<T>) -> Option<T> {
|
||||
match (self, optb) {
|
||||
(Some(a), None) => Some(a),
|
||||
|
||||
Reference in New Issue
Block a user