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:
Mazdak Farrokhzad
2019-06-13 01:49:24 +02:00
committed by GitHub
+1 -3
View File
@@ -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),